KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > java > security > spec > MGF1ParameterSpec


1 /*
2  * @(#)MGF1ParameterSpec.java 1.3 04/01/27
3  *
4  * Copyright 2004 Sun Microsystems, Inc. All rights reserved.
5  * SUN PROPRIETARY/CONFIDENTIAL. Use is subject to license terms.
6  */

7
8 package java.security.spec;
9
10 import java.security.spec.AlgorithmParameterSpec JavaDoc;
11
12 /**
13  * This class specifies the set of parameters used with mask generation
14  * function MGF1 in OAEP Padding and RSA-PSS signature scheme, as
15  * defined in the
16  * <a HREF="http://www.rsa.com/rsalabs/pubs/PKCS/html/pkcs-1.html">
17  * PKCS #1 v2.1</a> standard.
18  *
19  * <p>Its ASN.1 definition in PKCS#1 standard is described below:
20  * <pre>
21  * MGF1Parameters ::= OAEP-PSSDigestAlgorthms
22  * </pre>
23  * where
24  * <pre>
25  * OAEP-PSSDigestAlgorithms ALGORITHM-IDENTIFIER ::= {
26  * { OID id-sha1 PARAMETERS NULL }|
27  * { OID id-sha256 PARAMETERS NULL }|
28  * { OID id-sha384 PARAMETERS NULL }|
29  * { OID id-sha512 PARAMETERS NULL },
30  * ... -- Allows for future expansion --
31  * }
32  * </pre>
33  * @see PSSParameterSpec
34  * @see javax.crypto.spec.OAEPParameterSpec
35  *
36  * @author Valerie Peng
37  *
38  * @version 1.3, 01/27/04
39  * @since 1.5
40  */

41 public class MGF1ParameterSpec implements AlgorithmParameterSpec JavaDoc {
42
43     /**
44      * The MGF1ParameterSpec which uses "SHA-1" message digest.
45      */

46     public static final MGF1ParameterSpec JavaDoc SHA1 =
47     new MGF1ParameterSpec JavaDoc("SHA-1");
48     /**
49      * The MGF1ParameterSpec which uses "SHA-256" message digest.
50      */

51     public static final MGF1ParameterSpec JavaDoc SHA256 =
52     new MGF1ParameterSpec JavaDoc("SHA-256");
53     /**
54      * The MGF1ParameterSpec which uses "SHA-384" message digest.
55      */

56     public static final MGF1ParameterSpec JavaDoc SHA384 =
57     new MGF1ParameterSpec JavaDoc("SHA-384");
58     /**
59      * The MGF1ParameterSpec which uses SHA-512 message digest.
60      */

61     public static final MGF1ParameterSpec JavaDoc SHA512 =
62     new MGF1ParameterSpec JavaDoc("SHA-512");
63
64     private String JavaDoc mdName;
65
66     /**
67      * Constructs a parameter set for mask generation function MGF1
68      * as defined in the PKCS #1 standard.
69      *
70      * @param mdName the algorithm name for the message digest
71      * used in this mask generation function MGF1.
72      * @exception NullPointerException if <code>mdName</code> is null.
73      */

74     public MGF1ParameterSpec(String JavaDoc mdName) {
75     if (mdName == null) {
76         throw new NullPointerException JavaDoc("digest algorithm is null");
77     }
78     this.mdName = mdName;
79     }
80
81     /**
82      * Returns the algorithm name of the message digest used by the mask
83      * generation function.
84      *
85      * @return the algorithm name of the message digest.
86      */

87     public String JavaDoc getDigestAlgorithm() {
88         return mdName;
89     }
90 }
91
Popular Tags