author | naoto |
Tue, 15 Oct 2019 09:25:59 -0700 | |
changeset 58603 | 2312d1a04c49 |
parent 50204 | 3195a713e24d |
child 56592 | b1902b22005e |
permissions | -rw-r--r-- |
2 | 1 |
/* |
50204
3195a713e24d
8146293: Add support for RSASSA-PSS Signature algorithm
valeriep
parents:
47216
diff
changeset
|
2 |
* Copyright (c) 1999, 2018, Oracle and/or its affiliates. All rights reserved. |
2 | 3 |
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
4 |
* |
|
5 |
* This code is free software; you can redistribute it and/or modify it |
|
6 |
* under the terms of the GNU General Public License version 2 only, as |
|
5506 | 7 |
* published by the Free Software Foundation. Oracle designates this |
2 | 8 |
* particular file as subject to the "Classpath" exception as provided |
5506 | 9 |
* by Oracle in the LICENSE file that accompanied this code. |
2 | 10 |
* |
11 |
* This code is distributed in the hope that it will be useful, but WITHOUT |
|
12 |
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
|
13 |
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License |
|
14 |
* version 2 for more details (a copy is included in the LICENSE file that |
|
15 |
* accompanied this code). |
|
16 |
* |
|
17 |
* You should have received a copy of the GNU General Public License version |
|
18 |
* 2 along with this work; if not, write to the Free Software Foundation, |
|
19 |
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. |
|
20 |
* |
|
5506 | 21 |
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA |
22 |
* or visit www.oracle.com if you need additional information or have any |
|
23 |
* questions. |
|
2 | 24 |
*/ |
25 |
||
26 |
package java.security.spec; |
|
27 |
||
28 |
import java.math.BigInteger; |
|
29 |
import java.security.spec.AlgorithmParameterSpec; |
|
30 |
||
31 |
/** |
|
32 |
* This class specifies the set of parameters used to generate an RSA |
|
33 |
* key pair. |
|
34 |
* |
|
35 |
* @author Jan Luehe |
|
36 |
* |
|
37 |
* @see java.security.KeyPairGenerator#initialize(java.security.spec.AlgorithmParameterSpec) |
|
38 |
* |
|
39 |
* @since 1.3 |
|
40 |
*/ |
|
41 |
||
42 |
public class RSAKeyGenParameterSpec implements AlgorithmParameterSpec { |
|
43 |
||
44 |
private int keysize; |
|
45 |
private BigInteger publicExponent; |
|
50204
3195a713e24d
8146293: Add support for RSASSA-PSS Signature algorithm
valeriep
parents:
47216
diff
changeset
|
46 |
private AlgorithmParameterSpec keyParams; |
2 | 47 |
|
48 |
/** |
|
49 |
* The public-exponent value F0 = 3. |
|
50 |
*/ |
|
51 |
public static final BigInteger F0 = BigInteger.valueOf(3); |
|
52 |
||
53 |
/** |
|
54 |
* The public exponent-value F4 = 65537. |
|
55 |
*/ |
|
56 |
public static final BigInteger F4 = BigInteger.valueOf(65537); |
|
57 |
||
58 |
/** |
|
50204
3195a713e24d
8146293: Add support for RSASSA-PSS Signature algorithm
valeriep
parents:
47216
diff
changeset
|
59 |
* Constructs a new {@code RSAKeyGenParameterSpec} object from the |
3195a713e24d
8146293: Add support for RSASSA-PSS Signature algorithm
valeriep
parents:
47216
diff
changeset
|
60 |
* given keysize, public-exponent value, and null key parameters. |
2 | 61 |
* |
62 |
* @param keysize the modulus size (specified in number of bits) |
|
63 |
* @param publicExponent the public exponent |
|
64 |
*/ |
|
65 |
public RSAKeyGenParameterSpec(int keysize, BigInteger publicExponent) { |
|
50204
3195a713e24d
8146293: Add support for RSASSA-PSS Signature algorithm
valeriep
parents:
47216
diff
changeset
|
66 |
this(keysize, publicExponent, null); |
3195a713e24d
8146293: Add support for RSASSA-PSS Signature algorithm
valeriep
parents:
47216
diff
changeset
|
67 |
} |
3195a713e24d
8146293: Add support for RSASSA-PSS Signature algorithm
valeriep
parents:
47216
diff
changeset
|
68 |
|
3195a713e24d
8146293: Add support for RSASSA-PSS Signature algorithm
valeriep
parents:
47216
diff
changeset
|
69 |
/** |
3195a713e24d
8146293: Add support for RSASSA-PSS Signature algorithm
valeriep
parents:
47216
diff
changeset
|
70 |
* Constructs a new {@code RSAKeyGenParameterSpec} object from the |
3195a713e24d
8146293: Add support for RSASSA-PSS Signature algorithm
valeriep
parents:
47216
diff
changeset
|
71 |
* given keysize, public-exponent value, and key parameters. |
3195a713e24d
8146293: Add support for RSASSA-PSS Signature algorithm
valeriep
parents:
47216
diff
changeset
|
72 |
* |
3195a713e24d
8146293: Add support for RSASSA-PSS Signature algorithm
valeriep
parents:
47216
diff
changeset
|
73 |
* @param keysize the modulus size (specified in number of bits) |
3195a713e24d
8146293: Add support for RSASSA-PSS Signature algorithm
valeriep
parents:
47216
diff
changeset
|
74 |
* @param publicExponent the public exponent |
3195a713e24d
8146293: Add support for RSASSA-PSS Signature algorithm
valeriep
parents:
47216
diff
changeset
|
75 |
* @param keyParams the key parameters, may be null |
3195a713e24d
8146293: Add support for RSASSA-PSS Signature algorithm
valeriep
parents:
47216
diff
changeset
|
76 |
* @since 11 |
3195a713e24d
8146293: Add support for RSASSA-PSS Signature algorithm
valeriep
parents:
47216
diff
changeset
|
77 |
*/ |
3195a713e24d
8146293: Add support for RSASSA-PSS Signature algorithm
valeriep
parents:
47216
diff
changeset
|
78 |
public RSAKeyGenParameterSpec(int keysize, BigInteger publicExponent, |
3195a713e24d
8146293: Add support for RSASSA-PSS Signature algorithm
valeriep
parents:
47216
diff
changeset
|
79 |
AlgorithmParameterSpec keyParams) { |
2 | 80 |
this.keysize = keysize; |
81 |
this.publicExponent = publicExponent; |
|
50204
3195a713e24d
8146293: Add support for RSASSA-PSS Signature algorithm
valeriep
parents:
47216
diff
changeset
|
82 |
this.keyParams = keyParams; |
2 | 83 |
} |
84 |
||
85 |
/** |
|
86 |
* Returns the keysize. |
|
87 |
* |
|
88 |
* @return the keysize. |
|
89 |
*/ |
|
90 |
public int getKeysize() { |
|
91 |
return keysize; |
|
92 |
} |
|
93 |
||
94 |
/** |
|
95 |
* Returns the public-exponent value. |
|
96 |
* |
|
97 |
* @return the public-exponent value. |
|
98 |
*/ |
|
99 |
public BigInteger getPublicExponent() { |
|
100 |
return publicExponent; |
|
101 |
} |
|
50204
3195a713e24d
8146293: Add support for RSASSA-PSS Signature algorithm
valeriep
parents:
47216
diff
changeset
|
102 |
|
3195a713e24d
8146293: Add support for RSASSA-PSS Signature algorithm
valeriep
parents:
47216
diff
changeset
|
103 |
/** |
3195a713e24d
8146293: Add support for RSASSA-PSS Signature algorithm
valeriep
parents:
47216
diff
changeset
|
104 |
* Returns the parameters to be associated with key. |
3195a713e24d
8146293: Add support for RSASSA-PSS Signature algorithm
valeriep
parents:
47216
diff
changeset
|
105 |
* |
3195a713e24d
8146293: Add support for RSASSA-PSS Signature algorithm
valeriep
parents:
47216
diff
changeset
|
106 |
* @return the associated parameters, may be null if |
3195a713e24d
8146293: Add support for RSASSA-PSS Signature algorithm
valeriep
parents:
47216
diff
changeset
|
107 |
* not present |
3195a713e24d
8146293: Add support for RSASSA-PSS Signature algorithm
valeriep
parents:
47216
diff
changeset
|
108 |
* @since 11 |
3195a713e24d
8146293: Add support for RSASSA-PSS Signature algorithm
valeriep
parents:
47216
diff
changeset
|
109 |
*/ |
3195a713e24d
8146293: Add support for RSASSA-PSS Signature algorithm
valeriep
parents:
47216
diff
changeset
|
110 |
public AlgorithmParameterSpec getKeyParams() { |
3195a713e24d
8146293: Add support for RSASSA-PSS Signature algorithm
valeriep
parents:
47216
diff
changeset
|
111 |
return keyParams; |
3195a713e24d
8146293: Add support for RSASSA-PSS Signature algorithm
valeriep
parents:
47216
diff
changeset
|
112 |
} |
2 | 113 |
} |