0N/A/*
2362N/A * Copyright (c) 2003, 2006, Oracle and/or its affiliates. All rights reserved.
0N/A * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
0N/A *
0N/A * This code is free software; you can redistribute it and/or modify it
0N/A * under the terms of the GNU General Public License version 2 only, as
2362N/A * published by the Free Software Foundation. Oracle designates this
0N/A * particular file as subject to the "Classpath" exception as provided
2362N/A * by Oracle in the LICENSE file that accompanied this code.
0N/A *
0N/A * This code is distributed in the hope that it will be useful, but WITHOUT
0N/A * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
0N/A * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
0N/A * version 2 for more details (a copy is included in the LICENSE file that
0N/A * accompanied this code).
0N/A *
0N/A * You should have received a copy of the GNU General Public License version
0N/A * 2 along with this work; if not, write to the Free Software Foundation,
0N/A * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
0N/A *
2362N/A * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
2362N/A * or visit www.oracle.com if you need additional information or have any
2362N/A * questions.
0N/A */
0N/A
0N/Apackage java.security.spec;
0N/A
0N/Aimport java.security.spec.AlgorithmParameterSpec;
0N/A
0N/A/**
0N/A * This class specifies the set of parameters used with mask generation
0N/A * function MGF1 in OAEP Padding and RSA-PSS signature scheme, as
0N/A * defined in the
0N/A * <a href="http://www.ietf.org/rfc/rfc3447.txt">PKCS #1 v2.1</a>
0N/A * standard.
0N/A *
0N/A * <p>Its ASN.1 definition in PKCS#1 standard is described below:
0N/A * <pre>
0N/A * MGF1Parameters ::= OAEP-PSSDigestAlgorthms
0N/A * </pre>
0N/A * where
0N/A * <pre>
0N/A * OAEP-PSSDigestAlgorithms ALGORITHM-IDENTIFIER ::= {
0N/A * { OID id-sha1 PARAMETERS NULL }|
0N/A * { OID id-sha256 PARAMETERS NULL }|
0N/A * { OID id-sha384 PARAMETERS NULL }|
0N/A * { OID id-sha512 PARAMETERS NULL },
0N/A * ... -- Allows for future expansion --
0N/A * }
0N/A * </pre>
0N/A * @see PSSParameterSpec
0N/A * @see javax.crypto.spec.OAEPParameterSpec
0N/A *
0N/A * @author Valerie Peng
0N/A *
0N/A * @since 1.5
0N/A */
0N/Apublic class MGF1ParameterSpec implements AlgorithmParameterSpec {
0N/A
0N/A /**
0N/A * The MGF1ParameterSpec which uses "SHA-1" message digest.
0N/A */
0N/A public static final MGF1ParameterSpec SHA1 =
0N/A new MGF1ParameterSpec("SHA-1");
0N/A /**
0N/A * The MGF1ParameterSpec which uses "SHA-256" message digest.
0N/A */
0N/A public static final MGF1ParameterSpec SHA256 =
0N/A new MGF1ParameterSpec("SHA-256");
0N/A /**
0N/A * The MGF1ParameterSpec which uses "SHA-384" message digest.
0N/A */
0N/A public static final MGF1ParameterSpec SHA384 =
0N/A new MGF1ParameterSpec("SHA-384");
0N/A /**
0N/A * The MGF1ParameterSpec which uses SHA-512 message digest.
0N/A */
0N/A public static final MGF1ParameterSpec SHA512 =
0N/A new MGF1ParameterSpec("SHA-512");
0N/A
0N/A private String mdName;
0N/A
0N/A /**
0N/A * Constructs a parameter set for mask generation function MGF1
0N/A * as defined in the PKCS #1 standard.
0N/A *
0N/A * @param mdName the algorithm name for the message digest
0N/A * used in this mask generation function MGF1.
0N/A * @exception NullPointerException if <code>mdName</code> is null.
0N/A */
0N/A public MGF1ParameterSpec(String mdName) {
0N/A if (mdName == null) {
0N/A throw new NullPointerException("digest algorithm is null");
0N/A }
0N/A this.mdName = mdName;
0N/A }
0N/A
0N/A /**
0N/A * Returns the algorithm name of the message digest used by the mask
0N/A * generation function.
0N/A *
0N/A * @return the algorithm name of the message digest.
0N/A */
0N/A public String getDigestAlgorithm() {
0N/A return mdName;
0N/A }
0N/A}