author | valeriep |
Sat, 30 Jun 2018 00:33:05 +0000 | |
changeset 50918 | ebff24bd9302 |
parent 50204 | 3195a713e24d |
permissions | -rw-r--r-- |
50204
3195a713e24d
8146293: Add support for RSASSA-PSS Signature algorithm
valeriep
parents:
diff
changeset
|
1 |
/* |
3195a713e24d
8146293: Add support for RSASSA-PSS Signature algorithm
valeriep
parents:
diff
changeset
|
2 |
* Copyright (c) 2018, Oracle and/or its affiliates. All rights reserved. |
3195a713e24d
8146293: Add support for RSASSA-PSS Signature algorithm
valeriep
parents:
diff
changeset
|
3 |
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
3195a713e24d
8146293: Add support for RSASSA-PSS Signature algorithm
valeriep
parents:
diff
changeset
|
4 |
* |
3195a713e24d
8146293: Add support for RSASSA-PSS Signature algorithm
valeriep
parents:
diff
changeset
|
5 |
* This code is free software; you can redistribute it and/or modify it |
3195a713e24d
8146293: Add support for RSASSA-PSS Signature algorithm
valeriep
parents:
diff
changeset
|
6 |
* under the terms of the GNU General Public License version 2 only, as |
3195a713e24d
8146293: Add support for RSASSA-PSS Signature algorithm
valeriep
parents:
diff
changeset
|
7 |
* published by the Free Software Foundation. Oracle designates this |
3195a713e24d
8146293: Add support for RSASSA-PSS Signature algorithm
valeriep
parents:
diff
changeset
|
8 |
* particular file as subject to the "Classpath" exception as provided |
3195a713e24d
8146293: Add support for RSASSA-PSS Signature algorithm
valeriep
parents:
diff
changeset
|
9 |
* by Oracle in the LICENSE file that accompanied this code. |
3195a713e24d
8146293: Add support for RSASSA-PSS Signature algorithm
valeriep
parents:
diff
changeset
|
10 |
* |
3195a713e24d
8146293: Add support for RSASSA-PSS Signature algorithm
valeriep
parents:
diff
changeset
|
11 |
* This code is distributed in the hope that it will be useful, but WITHOUT |
3195a713e24d
8146293: Add support for RSASSA-PSS Signature algorithm
valeriep
parents:
diff
changeset
|
12 |
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
3195a713e24d
8146293: Add support for RSASSA-PSS Signature algorithm
valeriep
parents:
diff
changeset
|
13 |
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License |
3195a713e24d
8146293: Add support for RSASSA-PSS Signature algorithm
valeriep
parents:
diff
changeset
|
14 |
* version 2 for more details (a copy is included in the LICENSE file that |
3195a713e24d
8146293: Add support for RSASSA-PSS Signature algorithm
valeriep
parents:
diff
changeset
|
15 |
* accompanied this code). |
3195a713e24d
8146293: Add support for RSASSA-PSS Signature algorithm
valeriep
parents:
diff
changeset
|
16 |
* |
3195a713e24d
8146293: Add support for RSASSA-PSS Signature algorithm
valeriep
parents:
diff
changeset
|
17 |
* You should have received a copy of the GNU General Public License version |
3195a713e24d
8146293: Add support for RSASSA-PSS Signature algorithm
valeriep
parents:
diff
changeset
|
18 |
* 2 along with this work; if not, write to the Free Software Foundation, |
3195a713e24d
8146293: Add support for RSASSA-PSS Signature algorithm
valeriep
parents:
diff
changeset
|
19 |
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. |
3195a713e24d
8146293: Add support for RSASSA-PSS Signature algorithm
valeriep
parents:
diff
changeset
|
20 |
* |
3195a713e24d
8146293: Add support for RSASSA-PSS Signature algorithm
valeriep
parents:
diff
changeset
|
21 |
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA |
3195a713e24d
8146293: Add support for RSASSA-PSS Signature algorithm
valeriep
parents:
diff
changeset
|
22 |
* or visit www.oracle.com if you need additional information or have any |
3195a713e24d
8146293: Add support for RSASSA-PSS Signature algorithm
valeriep
parents:
diff
changeset
|
23 |
* questions. |
3195a713e24d
8146293: Add support for RSASSA-PSS Signature algorithm
valeriep
parents:
diff
changeset
|
24 |
*/ |
3195a713e24d
8146293: Add support for RSASSA-PSS Signature algorithm
valeriep
parents:
diff
changeset
|
25 |
|
3195a713e24d
8146293: Add support for RSASSA-PSS Signature algorithm
valeriep
parents:
diff
changeset
|
26 |
package sun.security.rsa; |
3195a713e24d
8146293: Add support for RSASSA-PSS Signature algorithm
valeriep
parents:
diff
changeset
|
27 |
|
3195a713e24d
8146293: Add support for RSASSA-PSS Signature algorithm
valeriep
parents:
diff
changeset
|
28 |
import java.io.IOException; |
3195a713e24d
8146293: Add support for RSASSA-PSS Signature algorithm
valeriep
parents:
diff
changeset
|
29 |
import java.security.*; |
3195a713e24d
8146293: Add support for RSASSA-PSS Signature algorithm
valeriep
parents:
diff
changeset
|
30 |
import java.security.spec.*; |
3195a713e24d
8146293: Add support for RSASSA-PSS Signature algorithm
valeriep
parents:
diff
changeset
|
31 |
import sun.security.util.ObjectIdentifier; |
3195a713e24d
8146293: Add support for RSASSA-PSS Signature algorithm
valeriep
parents:
diff
changeset
|
32 |
import sun.security.x509.AlgorithmId; |
3195a713e24d
8146293: Add support for RSASSA-PSS Signature algorithm
valeriep
parents:
diff
changeset
|
33 |
|
3195a713e24d
8146293: Add support for RSASSA-PSS Signature algorithm
valeriep
parents:
diff
changeset
|
34 |
/** |
3195a713e24d
8146293: Add support for RSASSA-PSS Signature algorithm
valeriep
parents:
diff
changeset
|
35 |
* Utility class for SunRsaSign provider. |
3195a713e24d
8146293: Add support for RSASSA-PSS Signature algorithm
valeriep
parents:
diff
changeset
|
36 |
* Currently used by RSAKeyPairGenerator and RSAKeyFactory. |
3195a713e24d
8146293: Add support for RSASSA-PSS Signature algorithm
valeriep
parents:
diff
changeset
|
37 |
* |
3195a713e24d
8146293: Add support for RSASSA-PSS Signature algorithm
valeriep
parents:
diff
changeset
|
38 |
* @since 11 |
3195a713e24d
8146293: Add support for RSASSA-PSS Signature algorithm
valeriep
parents:
diff
changeset
|
39 |
*/ |
3195a713e24d
8146293: Add support for RSASSA-PSS Signature algorithm
valeriep
parents:
diff
changeset
|
40 |
public class RSAUtil { |
3195a713e24d
8146293: Add support for RSASSA-PSS Signature algorithm
valeriep
parents:
diff
changeset
|
41 |
|
3195a713e24d
8146293: Add support for RSASSA-PSS Signature algorithm
valeriep
parents:
diff
changeset
|
42 |
public enum KeyType { |
3195a713e24d
8146293: Add support for RSASSA-PSS Signature algorithm
valeriep
parents:
diff
changeset
|
43 |
RSA ("RSA"), |
3195a713e24d
8146293: Add support for RSASSA-PSS Signature algorithm
valeriep
parents:
diff
changeset
|
44 |
PSS ("RSASSA-PSS") |
3195a713e24d
8146293: Add support for RSASSA-PSS Signature algorithm
valeriep
parents:
diff
changeset
|
45 |
; |
3195a713e24d
8146293: Add support for RSASSA-PSS Signature algorithm
valeriep
parents:
diff
changeset
|
46 |
|
3195a713e24d
8146293: Add support for RSASSA-PSS Signature algorithm
valeriep
parents:
diff
changeset
|
47 |
private final String algo; |
3195a713e24d
8146293: Add support for RSASSA-PSS Signature algorithm
valeriep
parents:
diff
changeset
|
48 |
|
3195a713e24d
8146293: Add support for RSASSA-PSS Signature algorithm
valeriep
parents:
diff
changeset
|
49 |
KeyType(String keyAlgo) { |
3195a713e24d
8146293: Add support for RSASSA-PSS Signature algorithm
valeriep
parents:
diff
changeset
|
50 |
this.algo = keyAlgo; |
3195a713e24d
8146293: Add support for RSASSA-PSS Signature algorithm
valeriep
parents:
diff
changeset
|
51 |
} |
3195a713e24d
8146293: Add support for RSASSA-PSS Signature algorithm
valeriep
parents:
diff
changeset
|
52 |
public String keyAlgo() { |
3195a713e24d
8146293: Add support for RSASSA-PSS Signature algorithm
valeriep
parents:
diff
changeset
|
53 |
return algo; |
3195a713e24d
8146293: Add support for RSASSA-PSS Signature algorithm
valeriep
parents:
diff
changeset
|
54 |
} |
50918
ebff24bd9302
8205720: KeyFactory#getKeySpec and translateKey thorws NullPointerException with Invalid key
valeriep
parents:
50204
diff
changeset
|
55 |
public static KeyType lookup(String name) |
ebff24bd9302
8205720: KeyFactory#getKeySpec and translateKey thorws NullPointerException with Invalid key
valeriep
parents:
50204
diff
changeset
|
56 |
throws InvalidKeyException, ProviderException { |
ebff24bd9302
8205720: KeyFactory#getKeySpec and translateKey thorws NullPointerException with Invalid key
valeriep
parents:
50204
diff
changeset
|
57 |
if (name == null) { |
ebff24bd9302
8205720: KeyFactory#getKeySpec and translateKey thorws NullPointerException with Invalid key
valeriep
parents:
50204
diff
changeset
|
58 |
throw new InvalidKeyException("Null key algorithm"); |
ebff24bd9302
8205720: KeyFactory#getKeySpec and translateKey thorws NullPointerException with Invalid key
valeriep
parents:
50204
diff
changeset
|
59 |
} |
50204
3195a713e24d
8146293: Add support for RSASSA-PSS Signature algorithm
valeriep
parents:
diff
changeset
|
60 |
for (KeyType kt : KeyType.values()) { |
3195a713e24d
8146293: Add support for RSASSA-PSS Signature algorithm
valeriep
parents:
diff
changeset
|
61 |
if (kt.keyAlgo().equalsIgnoreCase(name)) { |
3195a713e24d
8146293: Add support for RSASSA-PSS Signature algorithm
valeriep
parents:
diff
changeset
|
62 |
return kt; |
3195a713e24d
8146293: Add support for RSASSA-PSS Signature algorithm
valeriep
parents:
diff
changeset
|
63 |
} |
3195a713e24d
8146293: Add support for RSASSA-PSS Signature algorithm
valeriep
parents:
diff
changeset
|
64 |
} |
3195a713e24d
8146293: Add support for RSASSA-PSS Signature algorithm
valeriep
parents:
diff
changeset
|
65 |
// no match |
3195a713e24d
8146293: Add support for RSASSA-PSS Signature algorithm
valeriep
parents:
diff
changeset
|
66 |
throw new ProviderException("Unsupported algorithm " + name); |
3195a713e24d
8146293: Add support for RSASSA-PSS Signature algorithm
valeriep
parents:
diff
changeset
|
67 |
} |
3195a713e24d
8146293: Add support for RSASSA-PSS Signature algorithm
valeriep
parents:
diff
changeset
|
68 |
} |
3195a713e24d
8146293: Add support for RSASSA-PSS Signature algorithm
valeriep
parents:
diff
changeset
|
69 |
|
3195a713e24d
8146293: Add support for RSASSA-PSS Signature algorithm
valeriep
parents:
diff
changeset
|
70 |
public static void checkParamsAgainstType(KeyType type, |
3195a713e24d
8146293: Add support for RSASSA-PSS Signature algorithm
valeriep
parents:
diff
changeset
|
71 |
AlgorithmParameterSpec paramSpec) throws ProviderException { |
3195a713e24d
8146293: Add support for RSASSA-PSS Signature algorithm
valeriep
parents:
diff
changeset
|
72 |
switch (type) { |
3195a713e24d
8146293: Add support for RSASSA-PSS Signature algorithm
valeriep
parents:
diff
changeset
|
73 |
case RSA: |
3195a713e24d
8146293: Add support for RSASSA-PSS Signature algorithm
valeriep
parents:
diff
changeset
|
74 |
if (paramSpec != null) { |
3195a713e24d
8146293: Add support for RSASSA-PSS Signature algorithm
valeriep
parents:
diff
changeset
|
75 |
throw new ProviderException("null params expected for " + |
3195a713e24d
8146293: Add support for RSASSA-PSS Signature algorithm
valeriep
parents:
diff
changeset
|
76 |
type.keyAlgo()); |
3195a713e24d
8146293: Add support for RSASSA-PSS Signature algorithm
valeriep
parents:
diff
changeset
|
77 |
} |
3195a713e24d
8146293: Add support for RSASSA-PSS Signature algorithm
valeriep
parents:
diff
changeset
|
78 |
break; |
3195a713e24d
8146293: Add support for RSASSA-PSS Signature algorithm
valeriep
parents:
diff
changeset
|
79 |
case PSS: |
3195a713e24d
8146293: Add support for RSASSA-PSS Signature algorithm
valeriep
parents:
diff
changeset
|
80 |
if ((paramSpec != null) && |
3195a713e24d
8146293: Add support for RSASSA-PSS Signature algorithm
valeriep
parents:
diff
changeset
|
81 |
!(paramSpec instanceof PSSParameterSpec)) { |
3195a713e24d
8146293: Add support for RSASSA-PSS Signature algorithm
valeriep
parents:
diff
changeset
|
82 |
throw new ProviderException |
3195a713e24d
8146293: Add support for RSASSA-PSS Signature algorithm
valeriep
parents:
diff
changeset
|
83 |
("PSSParmeterSpec expected for " + type.keyAlgo()); |
3195a713e24d
8146293: Add support for RSASSA-PSS Signature algorithm
valeriep
parents:
diff
changeset
|
84 |
} |
3195a713e24d
8146293: Add support for RSASSA-PSS Signature algorithm
valeriep
parents:
diff
changeset
|
85 |
break; |
3195a713e24d
8146293: Add support for RSASSA-PSS Signature algorithm
valeriep
parents:
diff
changeset
|
86 |
default: |
3195a713e24d
8146293: Add support for RSASSA-PSS Signature algorithm
valeriep
parents:
diff
changeset
|
87 |
throw new ProviderException |
3195a713e24d
8146293: Add support for RSASSA-PSS Signature algorithm
valeriep
parents:
diff
changeset
|
88 |
("Unsupported RSA algorithm " + type); |
3195a713e24d
8146293: Add support for RSASSA-PSS Signature algorithm
valeriep
parents:
diff
changeset
|
89 |
} |
3195a713e24d
8146293: Add support for RSASSA-PSS Signature algorithm
valeriep
parents:
diff
changeset
|
90 |
} |
3195a713e24d
8146293: Add support for RSASSA-PSS Signature algorithm
valeriep
parents:
diff
changeset
|
91 |
|
3195a713e24d
8146293: Add support for RSASSA-PSS Signature algorithm
valeriep
parents:
diff
changeset
|
92 |
public static AlgorithmId createAlgorithmId(KeyType type, |
3195a713e24d
8146293: Add support for RSASSA-PSS Signature algorithm
valeriep
parents:
diff
changeset
|
93 |
AlgorithmParameterSpec paramSpec) throws ProviderException { |
3195a713e24d
8146293: Add support for RSASSA-PSS Signature algorithm
valeriep
parents:
diff
changeset
|
94 |
|
3195a713e24d
8146293: Add support for RSASSA-PSS Signature algorithm
valeriep
parents:
diff
changeset
|
95 |
checkParamsAgainstType(type, paramSpec); |
3195a713e24d
8146293: Add support for RSASSA-PSS Signature algorithm
valeriep
parents:
diff
changeset
|
96 |
|
3195a713e24d
8146293: Add support for RSASSA-PSS Signature algorithm
valeriep
parents:
diff
changeset
|
97 |
ObjectIdentifier oid = null; |
3195a713e24d
8146293: Add support for RSASSA-PSS Signature algorithm
valeriep
parents:
diff
changeset
|
98 |
AlgorithmParameters params = null; |
3195a713e24d
8146293: Add support for RSASSA-PSS Signature algorithm
valeriep
parents:
diff
changeset
|
99 |
try { |
3195a713e24d
8146293: Add support for RSASSA-PSS Signature algorithm
valeriep
parents:
diff
changeset
|
100 |
switch (type) { |
3195a713e24d
8146293: Add support for RSASSA-PSS Signature algorithm
valeriep
parents:
diff
changeset
|
101 |
case RSA: |
3195a713e24d
8146293: Add support for RSASSA-PSS Signature algorithm
valeriep
parents:
diff
changeset
|
102 |
oid = AlgorithmId.RSAEncryption_oid; |
3195a713e24d
8146293: Add support for RSASSA-PSS Signature algorithm
valeriep
parents:
diff
changeset
|
103 |
break; |
3195a713e24d
8146293: Add support for RSASSA-PSS Signature algorithm
valeriep
parents:
diff
changeset
|
104 |
case PSS: |
3195a713e24d
8146293: Add support for RSASSA-PSS Signature algorithm
valeriep
parents:
diff
changeset
|
105 |
if (paramSpec != null) { |
3195a713e24d
8146293: Add support for RSASSA-PSS Signature algorithm
valeriep
parents:
diff
changeset
|
106 |
params = AlgorithmParameters.getInstance(type.keyAlgo()); |
3195a713e24d
8146293: Add support for RSASSA-PSS Signature algorithm
valeriep
parents:
diff
changeset
|
107 |
params.init(paramSpec); |
3195a713e24d
8146293: Add support for RSASSA-PSS Signature algorithm
valeriep
parents:
diff
changeset
|
108 |
} |
3195a713e24d
8146293: Add support for RSASSA-PSS Signature algorithm
valeriep
parents:
diff
changeset
|
109 |
oid = AlgorithmId.RSASSA_PSS_oid; |
3195a713e24d
8146293: Add support for RSASSA-PSS Signature algorithm
valeriep
parents:
diff
changeset
|
110 |
break; |
3195a713e24d
8146293: Add support for RSASSA-PSS Signature algorithm
valeriep
parents:
diff
changeset
|
111 |
default: |
3195a713e24d
8146293: Add support for RSASSA-PSS Signature algorithm
valeriep
parents:
diff
changeset
|
112 |
throw new ProviderException |
3195a713e24d
8146293: Add support for RSASSA-PSS Signature algorithm
valeriep
parents:
diff
changeset
|
113 |
("Unsupported RSA algorithm " + type); |
3195a713e24d
8146293: Add support for RSASSA-PSS Signature algorithm
valeriep
parents:
diff
changeset
|
114 |
} |
3195a713e24d
8146293: Add support for RSASSA-PSS Signature algorithm
valeriep
parents:
diff
changeset
|
115 |
AlgorithmId result; |
3195a713e24d
8146293: Add support for RSASSA-PSS Signature algorithm
valeriep
parents:
diff
changeset
|
116 |
if (params == null) { |
3195a713e24d
8146293: Add support for RSASSA-PSS Signature algorithm
valeriep
parents:
diff
changeset
|
117 |
result = new AlgorithmId(oid); |
3195a713e24d
8146293: Add support for RSASSA-PSS Signature algorithm
valeriep
parents:
diff
changeset
|
118 |
} else { |
3195a713e24d
8146293: Add support for RSASSA-PSS Signature algorithm
valeriep
parents:
diff
changeset
|
119 |
result = new AlgorithmId(oid, params); |
3195a713e24d
8146293: Add support for RSASSA-PSS Signature algorithm
valeriep
parents:
diff
changeset
|
120 |
} |
3195a713e24d
8146293: Add support for RSASSA-PSS Signature algorithm
valeriep
parents:
diff
changeset
|
121 |
return result; |
3195a713e24d
8146293: Add support for RSASSA-PSS Signature algorithm
valeriep
parents:
diff
changeset
|
122 |
} catch (NoSuchAlgorithmException | InvalidParameterSpecException e) { |
3195a713e24d
8146293: Add support for RSASSA-PSS Signature algorithm
valeriep
parents:
diff
changeset
|
123 |
// should not happen |
3195a713e24d
8146293: Add support for RSASSA-PSS Signature algorithm
valeriep
parents:
diff
changeset
|
124 |
throw new ProviderException(e); |
3195a713e24d
8146293: Add support for RSASSA-PSS Signature algorithm
valeriep
parents:
diff
changeset
|
125 |
} |
3195a713e24d
8146293: Add support for RSASSA-PSS Signature algorithm
valeriep
parents:
diff
changeset
|
126 |
} |
3195a713e24d
8146293: Add support for RSASSA-PSS Signature algorithm
valeriep
parents:
diff
changeset
|
127 |
|
3195a713e24d
8146293: Add support for RSASSA-PSS Signature algorithm
valeriep
parents:
diff
changeset
|
128 |
public static AlgorithmParameterSpec getParamSpec(AlgorithmId algid) |
3195a713e24d
8146293: Add support for RSASSA-PSS Signature algorithm
valeriep
parents:
diff
changeset
|
129 |
throws ProviderException { |
3195a713e24d
8146293: Add support for RSASSA-PSS Signature algorithm
valeriep
parents:
diff
changeset
|
130 |
if (algid == null) { |
3195a713e24d
8146293: Add support for RSASSA-PSS Signature algorithm
valeriep
parents:
diff
changeset
|
131 |
throw new ProviderException("AlgorithmId should not be null"); |
3195a713e24d
8146293: Add support for RSASSA-PSS Signature algorithm
valeriep
parents:
diff
changeset
|
132 |
} |
3195a713e24d
8146293: Add support for RSASSA-PSS Signature algorithm
valeriep
parents:
diff
changeset
|
133 |
return getParamSpec(algid.getParameters()); |
3195a713e24d
8146293: Add support for RSASSA-PSS Signature algorithm
valeriep
parents:
diff
changeset
|
134 |
} |
3195a713e24d
8146293: Add support for RSASSA-PSS Signature algorithm
valeriep
parents:
diff
changeset
|
135 |
|
3195a713e24d
8146293: Add support for RSASSA-PSS Signature algorithm
valeriep
parents:
diff
changeset
|
136 |
public static AlgorithmParameterSpec getParamSpec(AlgorithmParameters params) |
3195a713e24d
8146293: Add support for RSASSA-PSS Signature algorithm
valeriep
parents:
diff
changeset
|
137 |
throws ProviderException { |
3195a713e24d
8146293: Add support for RSASSA-PSS Signature algorithm
valeriep
parents:
diff
changeset
|
138 |
if (params == null) return null; |
3195a713e24d
8146293: Add support for RSASSA-PSS Signature algorithm
valeriep
parents:
diff
changeset
|
139 |
|
3195a713e24d
8146293: Add support for RSASSA-PSS Signature algorithm
valeriep
parents:
diff
changeset
|
140 |
try { |
50918
ebff24bd9302
8205720: KeyFactory#getKeySpec and translateKey thorws NullPointerException with Invalid key
valeriep
parents:
50204
diff
changeset
|
141 |
String algName = params.getAlgorithm(); |
ebff24bd9302
8205720: KeyFactory#getKeySpec and translateKey thorws NullPointerException with Invalid key
valeriep
parents:
50204
diff
changeset
|
142 |
KeyType type = KeyType.lookup(algName); |
ebff24bd9302
8205720: KeyFactory#getKeySpec and translateKey thorws NullPointerException with Invalid key
valeriep
parents:
50204
diff
changeset
|
143 |
Class<? extends AlgorithmParameterSpec> specCls; |
ebff24bd9302
8205720: KeyFactory#getKeySpec and translateKey thorws NullPointerException with Invalid key
valeriep
parents:
50204
diff
changeset
|
144 |
switch (type) { |
ebff24bd9302
8205720: KeyFactory#getKeySpec and translateKey thorws NullPointerException with Invalid key
valeriep
parents:
50204
diff
changeset
|
145 |
case RSA: |
ebff24bd9302
8205720: KeyFactory#getKeySpec and translateKey thorws NullPointerException with Invalid key
valeriep
parents:
50204
diff
changeset
|
146 |
throw new ProviderException("No params accepted for " + |
ebff24bd9302
8205720: KeyFactory#getKeySpec and translateKey thorws NullPointerException with Invalid key
valeriep
parents:
50204
diff
changeset
|
147 |
type.keyAlgo()); |
ebff24bd9302
8205720: KeyFactory#getKeySpec and translateKey thorws NullPointerException with Invalid key
valeriep
parents:
50204
diff
changeset
|
148 |
case PSS: |
ebff24bd9302
8205720: KeyFactory#getKeySpec and translateKey thorws NullPointerException with Invalid key
valeriep
parents:
50204
diff
changeset
|
149 |
specCls = PSSParameterSpec.class; |
ebff24bd9302
8205720: KeyFactory#getKeySpec and translateKey thorws NullPointerException with Invalid key
valeriep
parents:
50204
diff
changeset
|
150 |
break; |
ebff24bd9302
8205720: KeyFactory#getKeySpec and translateKey thorws NullPointerException with Invalid key
valeriep
parents:
50204
diff
changeset
|
151 |
default: |
ebff24bd9302
8205720: KeyFactory#getKeySpec and translateKey thorws NullPointerException with Invalid key
valeriep
parents:
50204
diff
changeset
|
152 |
throw new ProviderException("Unsupported RSA algorithm: " + algName); |
ebff24bd9302
8205720: KeyFactory#getKeySpec and translateKey thorws NullPointerException with Invalid key
valeriep
parents:
50204
diff
changeset
|
153 |
} |
50204
3195a713e24d
8146293: Add support for RSASSA-PSS Signature algorithm
valeriep
parents:
diff
changeset
|
154 |
return params.getParameterSpec(specCls); |
50918
ebff24bd9302
8205720: KeyFactory#getKeySpec and translateKey thorws NullPointerException with Invalid key
valeriep
parents:
50204
diff
changeset
|
155 |
} catch (ProviderException pe) { |
ebff24bd9302
8205720: KeyFactory#getKeySpec and translateKey thorws NullPointerException with Invalid key
valeriep
parents:
50204
diff
changeset
|
156 |
// pass it up |
ebff24bd9302
8205720: KeyFactory#getKeySpec and translateKey thorws NullPointerException with Invalid key
valeriep
parents:
50204
diff
changeset
|
157 |
throw pe; |
50204
3195a713e24d
8146293: Add support for RSASSA-PSS Signature algorithm
valeriep
parents:
diff
changeset
|
158 |
} catch (Exception e) { |
3195a713e24d
8146293: Add support for RSASSA-PSS Signature algorithm
valeriep
parents:
diff
changeset
|
159 |
throw new ProviderException(e); |
3195a713e24d
8146293: Add support for RSASSA-PSS Signature algorithm
valeriep
parents:
diff
changeset
|
160 |
} |
3195a713e24d
8146293: Add support for RSASSA-PSS Signature algorithm
valeriep
parents:
diff
changeset
|
161 |
} |
3195a713e24d
8146293: Add support for RSASSA-PSS Signature algorithm
valeriep
parents:
diff
changeset
|
162 |
} |