author | valeriep |
Mon, 21 May 2018 23:40:52 +0000 | |
changeset 50204 | 3195a713e24d |
parent 47216 | 71c04702a3d5 |
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) 1998, 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 |
||
30 |
/** |
|
31 |
* This class specifies an RSA private key. |
|
32 |
* |
|
33 |
* @author Jan Luehe |
|
45434
4582657c7260
8181082: class-level since tag issues in java.base & java.datatransfer module
mli
parents:
25859
diff
changeset
|
34 |
* @since 1.2 |
2 | 35 |
* |
36 |
* |
|
37 |
* @see java.security.Key |
|
38 |
* @see java.security.KeyFactory |
|
39 |
* @see KeySpec |
|
40 |
* @see PKCS8EncodedKeySpec |
|
41 |
* @see RSAPublicKeySpec |
|
42 |
* @see RSAPrivateCrtKeySpec |
|
43 |
*/ |
|
44 |
||
45 |
public class RSAPrivateKeySpec implements KeySpec { |
|
46 |
||
50204
3195a713e24d
8146293: Add support for RSASSA-PSS Signature algorithm
valeriep
parents:
47216
diff
changeset
|
47 |
private final BigInteger modulus; |
3195a713e24d
8146293: Add support for RSASSA-PSS Signature algorithm
valeriep
parents:
47216
diff
changeset
|
48 |
private final BigInteger privateExponent; |
3195a713e24d
8146293: Add support for RSASSA-PSS Signature algorithm
valeriep
parents:
47216
diff
changeset
|
49 |
private final AlgorithmParameterSpec params; |
2 | 50 |
|
51 |
/** |
|
52 |
* Creates a new RSAPrivateKeySpec. |
|
53 |
* |
|
54 |
* @param modulus the modulus |
|
55 |
* @param privateExponent the private exponent |
|
56 |
*/ |
|
57 |
public RSAPrivateKeySpec(BigInteger modulus, BigInteger privateExponent) { |
|
50204
3195a713e24d
8146293: Add support for RSASSA-PSS Signature algorithm
valeriep
parents:
47216
diff
changeset
|
58 |
this(modulus, privateExponent, null); |
3195a713e24d
8146293: Add support for RSASSA-PSS Signature algorithm
valeriep
parents:
47216
diff
changeset
|
59 |
} |
3195a713e24d
8146293: Add support for RSASSA-PSS Signature algorithm
valeriep
parents:
47216
diff
changeset
|
60 |
|
3195a713e24d
8146293: Add support for RSASSA-PSS Signature algorithm
valeriep
parents:
47216
diff
changeset
|
61 |
/** |
3195a713e24d
8146293: Add support for RSASSA-PSS Signature algorithm
valeriep
parents:
47216
diff
changeset
|
62 |
* Creates a new RSAPrivateKeySpec with additional key parameters. |
3195a713e24d
8146293: Add support for RSASSA-PSS Signature algorithm
valeriep
parents:
47216
diff
changeset
|
63 |
* |
3195a713e24d
8146293: Add support for RSASSA-PSS Signature algorithm
valeriep
parents:
47216
diff
changeset
|
64 |
* @param modulus the modulus |
3195a713e24d
8146293: Add support for RSASSA-PSS Signature algorithm
valeriep
parents:
47216
diff
changeset
|
65 |
* @param privateExponent the private exponent |
3195a713e24d
8146293: Add support for RSASSA-PSS Signature algorithm
valeriep
parents:
47216
diff
changeset
|
66 |
* @param params the parameters associated with this key, may be null |
3195a713e24d
8146293: Add support for RSASSA-PSS Signature algorithm
valeriep
parents:
47216
diff
changeset
|
67 |
* @since 11 |
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 |
public RSAPrivateKeySpec(BigInteger modulus, BigInteger privateExponent, |
3195a713e24d
8146293: Add support for RSASSA-PSS Signature algorithm
valeriep
parents:
47216
diff
changeset
|
70 |
AlgorithmParameterSpec params) { |
2 | 71 |
this.modulus = modulus; |
72 |
this.privateExponent = privateExponent; |
|
50204
3195a713e24d
8146293: Add support for RSASSA-PSS Signature algorithm
valeriep
parents:
47216
diff
changeset
|
73 |
this.params = params; |
2 | 74 |
} |
75 |
||
76 |
/** |
|
77 |
* Returns the modulus. |
|
78 |
* |
|
79 |
* @return the modulus |
|
80 |
*/ |
|
81 |
public BigInteger getModulus() { |
|
82 |
return this.modulus; |
|
83 |
} |
|
84 |
||
85 |
/** |
|
86 |
* Returns the private exponent. |
|
87 |
* |
|
88 |
* @return the private exponent |
|
89 |
*/ |
|
90 |
public BigInteger getPrivateExponent() { |
|
91 |
return this.privateExponent; |
|
92 |
} |
|
50204
3195a713e24d
8146293: Add support for RSASSA-PSS Signature algorithm
valeriep
parents:
47216
diff
changeset
|
93 |
|
3195a713e24d
8146293: Add support for RSASSA-PSS Signature algorithm
valeriep
parents:
47216
diff
changeset
|
94 |
/** |
3195a713e24d
8146293: Add support for RSASSA-PSS Signature algorithm
valeriep
parents:
47216
diff
changeset
|
95 |
* Returns the parameters associated with this key, may be null if not |
3195a713e24d
8146293: Add support for RSASSA-PSS Signature algorithm
valeriep
parents:
47216
diff
changeset
|
96 |
* present. |
3195a713e24d
8146293: Add support for RSASSA-PSS Signature algorithm
valeriep
parents:
47216
diff
changeset
|
97 |
* |
3195a713e24d
8146293: Add support for RSASSA-PSS Signature algorithm
valeriep
parents:
47216
diff
changeset
|
98 |
* @return the parameters associated with this key |
3195a713e24d
8146293: Add support for RSASSA-PSS Signature algorithm
valeriep
parents:
47216
diff
changeset
|
99 |
* @since 11 |
3195a713e24d
8146293: Add support for RSASSA-PSS Signature algorithm
valeriep
parents:
47216
diff
changeset
|
100 |
*/ |
3195a713e24d
8146293: Add support for RSASSA-PSS Signature algorithm
valeriep
parents:
47216
diff
changeset
|
101 |
public AlgorithmParameterSpec getParams() { |
3195a713e24d
8146293: Add support for RSASSA-PSS Signature algorithm
valeriep
parents:
47216
diff
changeset
|
102 |
return this.params; |
3195a713e24d
8146293: Add support for RSASSA-PSS Signature algorithm
valeriep
parents:
47216
diff
changeset
|
103 |
} |
2 | 104 |
} |