author | valeriep |
Mon, 21 May 2018 23:40:52 +0000 | |
changeset 50204 | 3195a713e24d |
parent 47216 | 71c04702a3d5 |
child 50715 | 46492a773912 |
permissions | -rw-r--r-- |
2 | 1 |
/* |
50204
3195a713e24d
8146293: Add support for RSASSA-PSS Signature algorithm
valeriep
parents:
47216
diff
changeset
|
2 |
* Copyright (c) 2005, 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 sun.security.mscapi; |
|
27 |
||
28 |
import java.nio.ByteBuffer; |
|
50204
3195a713e24d
8146293: Add support for RSASSA-PSS Signature algorithm
valeriep
parents:
47216
diff
changeset
|
29 |
import java.security.*; |
3195a713e24d
8146293: Add support for RSASSA-PSS Signature algorithm
valeriep
parents:
47216
diff
changeset
|
30 |
import java.security.spec.AlgorithmParameterSpec; |
2596 | 31 |
import java.math.BigInteger; |
32 |
||
33 |
import sun.security.rsa.RSAKeyFactory; |
|
2 | 34 |
|
35 |
/** |
|
36 |
* RSA signature implementation. Supports RSA signing using PKCS#1 v1.5 padding. |
|
37 |
* |
|
38 |
* Objects should be instantiated by calling Signature.getInstance() using the |
|
39 |
* following algorithm names: |
|
40 |
* |
|
9533
13cc5e8eb9f1
6578658: Request for raw RSA (NONEwithRSA) Signature support in SunMSCAPI
vinnie
parents:
9524
diff
changeset
|
41 |
* . "NONEwithRSA" |
2 | 42 |
* . "SHA1withRSA" |
9524 | 43 |
* . "SHA256withRSA" |
44 |
* . "SHA384withRSA" |
|
45 |
* . "SHA512withRSA" |
|
2 | 46 |
* . "MD5withRSA" |
47 |
* . "MD2withRSA" |
|
48 |
* |
|
9533
13cc5e8eb9f1
6578658: Request for raw RSA (NONEwithRSA) Signature support in SunMSCAPI
vinnie
parents:
9524
diff
changeset
|
49 |
* NOTE: RSA keys must be at least 512 bits long. |
13cc5e8eb9f1
6578658: Request for raw RSA (NONEwithRSA) Signature support in SunMSCAPI
vinnie
parents:
9524
diff
changeset
|
50 |
* |
13cc5e8eb9f1
6578658: Request for raw RSA (NONEwithRSA) Signature support in SunMSCAPI
vinnie
parents:
9524
diff
changeset
|
51 |
* NOTE: NONEwithRSA must be supplied with a pre-computed message digest. |
13cc5e8eb9f1
6578658: Request for raw RSA (NONEwithRSA) Signature support in SunMSCAPI
vinnie
parents:
9524
diff
changeset
|
52 |
* Only the following digest algorithms are supported: MD5, SHA-1, |
12700
9c9ad46c7c40
7169496: Problem with the SHA-224 support for SunMSCAPI provider
valeriep
parents:
12685
diff
changeset
|
53 |
* SHA-256, SHA-384, SHA-512 and a special-purpose digest |
12685 | 54 |
* algorithm which is a concatenation of SHA-1 and MD5 digests. |
2 | 55 |
* |
56 |
* @since 1.6 |
|
57 |
* @author Stanley Man-Kit Ho |
|
58 |
*/ |
|
59 |
abstract class RSASignature extends java.security.SignatureSpi |
|
60 |
{ |
|
61 |
// message digest implementation we use |
|
62 |
private final MessageDigest messageDigest; |
|
63 |
||
9524 | 64 |
// message digest name |
9533
13cc5e8eb9f1
6578658: Request for raw RSA (NONEwithRSA) Signature support in SunMSCAPI
vinnie
parents:
9524
diff
changeset
|
65 |
private String messageDigestAlgorithm; |
9524 | 66 |
|
67 |
// flag indicating whether the digest has been reset |
|
2 | 68 |
private boolean needsReset; |
69 |
||
70 |
// the signing key |
|
71 |
private Key privateKey = null; |
|
72 |
||
73 |
// the verification key |
|
74 |
private Key publicKey = null; |
|
75 |
||
9533
13cc5e8eb9f1
6578658: Request for raw RSA (NONEwithRSA) Signature support in SunMSCAPI
vinnie
parents:
9524
diff
changeset
|
76 |
/** |
13cc5e8eb9f1
6578658: Request for raw RSA (NONEwithRSA) Signature support in SunMSCAPI
vinnie
parents:
9524
diff
changeset
|
77 |
* Constructs a new RSASignature. Used by Raw subclass. |
13cc5e8eb9f1
6578658: Request for raw RSA (NONEwithRSA) Signature support in SunMSCAPI
vinnie
parents:
9524
diff
changeset
|
78 |
*/ |
13cc5e8eb9f1
6578658: Request for raw RSA (NONEwithRSA) Signature support in SunMSCAPI
vinnie
parents:
9524
diff
changeset
|
79 |
RSASignature() { |
13cc5e8eb9f1
6578658: Request for raw RSA (NONEwithRSA) Signature support in SunMSCAPI
vinnie
parents:
9524
diff
changeset
|
80 |
messageDigest = null; |
13cc5e8eb9f1
6578658: Request for raw RSA (NONEwithRSA) Signature support in SunMSCAPI
vinnie
parents:
9524
diff
changeset
|
81 |
messageDigestAlgorithm = null; |
13cc5e8eb9f1
6578658: Request for raw RSA (NONEwithRSA) Signature support in SunMSCAPI
vinnie
parents:
9524
diff
changeset
|
82 |
} |
2 | 83 |
|
9524 | 84 |
/** |
85 |
* Constructs a new RSASignature. Used by subclasses. |
|
86 |
*/ |
|
2 | 87 |
RSASignature(String digestName) { |
88 |
||
89 |
try { |
|
90 |
messageDigest = MessageDigest.getInstance(digestName); |
|
9524 | 91 |
// Get the digest's canonical name |
92 |
messageDigestAlgorithm = messageDigest.getAlgorithm(); |
|
2 | 93 |
|
94 |
} catch (NoSuchAlgorithmException e) { |
|
95 |
throw new ProviderException(e); |
|
96 |
} |
|
97 |
||
98 |
needsReset = false; |
|
99 |
} |
|
100 |
||
9533
13cc5e8eb9f1
6578658: Request for raw RSA (NONEwithRSA) Signature support in SunMSCAPI
vinnie
parents:
9524
diff
changeset
|
101 |
// Nested class for NONEwithRSA signatures |
13cc5e8eb9f1
6578658: Request for raw RSA (NONEwithRSA) Signature support in SunMSCAPI
vinnie
parents:
9524
diff
changeset
|
102 |
public static final class Raw extends RSASignature { |
13cc5e8eb9f1
6578658: Request for raw RSA (NONEwithRSA) Signature support in SunMSCAPI
vinnie
parents:
9524
diff
changeset
|
103 |
|
13cc5e8eb9f1
6578658: Request for raw RSA (NONEwithRSA) Signature support in SunMSCAPI
vinnie
parents:
9524
diff
changeset
|
104 |
// the longest supported digest is 512 bits (SHA-512) |
13cc5e8eb9f1
6578658: Request for raw RSA (NONEwithRSA) Signature support in SunMSCAPI
vinnie
parents:
9524
diff
changeset
|
105 |
private static final int RAW_RSA_MAX = 64; |
13cc5e8eb9f1
6578658: Request for raw RSA (NONEwithRSA) Signature support in SunMSCAPI
vinnie
parents:
9524
diff
changeset
|
106 |
|
13cc5e8eb9f1
6578658: Request for raw RSA (NONEwithRSA) Signature support in SunMSCAPI
vinnie
parents:
9524
diff
changeset
|
107 |
private final byte[] precomputedDigest; |
13cc5e8eb9f1
6578658: Request for raw RSA (NONEwithRSA) Signature support in SunMSCAPI
vinnie
parents:
9524
diff
changeset
|
108 |
private int offset = 0; |
13cc5e8eb9f1
6578658: Request for raw RSA (NONEwithRSA) Signature support in SunMSCAPI
vinnie
parents:
9524
diff
changeset
|
109 |
|
13cc5e8eb9f1
6578658: Request for raw RSA (NONEwithRSA) Signature support in SunMSCAPI
vinnie
parents:
9524
diff
changeset
|
110 |
public Raw() { |
13cc5e8eb9f1
6578658: Request for raw RSA (NONEwithRSA) Signature support in SunMSCAPI
vinnie
parents:
9524
diff
changeset
|
111 |
precomputedDigest = new byte[RAW_RSA_MAX]; |
13cc5e8eb9f1
6578658: Request for raw RSA (NONEwithRSA) Signature support in SunMSCAPI
vinnie
parents:
9524
diff
changeset
|
112 |
} |
13cc5e8eb9f1
6578658: Request for raw RSA (NONEwithRSA) Signature support in SunMSCAPI
vinnie
parents:
9524
diff
changeset
|
113 |
|
13cc5e8eb9f1
6578658: Request for raw RSA (NONEwithRSA) Signature support in SunMSCAPI
vinnie
parents:
9524
diff
changeset
|
114 |
// Stores the precomputed message digest value. |
13cc5e8eb9f1
6578658: Request for raw RSA (NONEwithRSA) Signature support in SunMSCAPI
vinnie
parents:
9524
diff
changeset
|
115 |
@Override |
13cc5e8eb9f1
6578658: Request for raw RSA (NONEwithRSA) Signature support in SunMSCAPI
vinnie
parents:
9524
diff
changeset
|
116 |
protected void engineUpdate(byte b) throws SignatureException { |
13cc5e8eb9f1
6578658: Request for raw RSA (NONEwithRSA) Signature support in SunMSCAPI
vinnie
parents:
9524
diff
changeset
|
117 |
if (offset >= precomputedDigest.length) { |
13cc5e8eb9f1
6578658: Request for raw RSA (NONEwithRSA) Signature support in SunMSCAPI
vinnie
parents:
9524
diff
changeset
|
118 |
offset = RAW_RSA_MAX + 1; |
13cc5e8eb9f1
6578658: Request for raw RSA (NONEwithRSA) Signature support in SunMSCAPI
vinnie
parents:
9524
diff
changeset
|
119 |
return; |
13cc5e8eb9f1
6578658: Request for raw RSA (NONEwithRSA) Signature support in SunMSCAPI
vinnie
parents:
9524
diff
changeset
|
120 |
} |
13cc5e8eb9f1
6578658: Request for raw RSA (NONEwithRSA) Signature support in SunMSCAPI
vinnie
parents:
9524
diff
changeset
|
121 |
precomputedDigest[offset++] = b; |
13cc5e8eb9f1
6578658: Request for raw RSA (NONEwithRSA) Signature support in SunMSCAPI
vinnie
parents:
9524
diff
changeset
|
122 |
} |
13cc5e8eb9f1
6578658: Request for raw RSA (NONEwithRSA) Signature support in SunMSCAPI
vinnie
parents:
9524
diff
changeset
|
123 |
|
13cc5e8eb9f1
6578658: Request for raw RSA (NONEwithRSA) Signature support in SunMSCAPI
vinnie
parents:
9524
diff
changeset
|
124 |
// Stores the precomputed message digest value. |
13cc5e8eb9f1
6578658: Request for raw RSA (NONEwithRSA) Signature support in SunMSCAPI
vinnie
parents:
9524
diff
changeset
|
125 |
@Override |
13cc5e8eb9f1
6578658: Request for raw RSA (NONEwithRSA) Signature support in SunMSCAPI
vinnie
parents:
9524
diff
changeset
|
126 |
protected void engineUpdate(byte[] b, int off, int len) |
13cc5e8eb9f1
6578658: Request for raw RSA (NONEwithRSA) Signature support in SunMSCAPI
vinnie
parents:
9524
diff
changeset
|
127 |
throws SignatureException { |
13cc5e8eb9f1
6578658: Request for raw RSA (NONEwithRSA) Signature support in SunMSCAPI
vinnie
parents:
9524
diff
changeset
|
128 |
if (offset + len > precomputedDigest.length) { |
13cc5e8eb9f1
6578658: Request for raw RSA (NONEwithRSA) Signature support in SunMSCAPI
vinnie
parents:
9524
diff
changeset
|
129 |
offset = RAW_RSA_MAX + 1; |
13cc5e8eb9f1
6578658: Request for raw RSA (NONEwithRSA) Signature support in SunMSCAPI
vinnie
parents:
9524
diff
changeset
|
130 |
return; |
13cc5e8eb9f1
6578658: Request for raw RSA (NONEwithRSA) Signature support in SunMSCAPI
vinnie
parents:
9524
diff
changeset
|
131 |
} |
13cc5e8eb9f1
6578658: Request for raw RSA (NONEwithRSA) Signature support in SunMSCAPI
vinnie
parents:
9524
diff
changeset
|
132 |
System.arraycopy(b, off, precomputedDigest, offset, len); |
13cc5e8eb9f1
6578658: Request for raw RSA (NONEwithRSA) Signature support in SunMSCAPI
vinnie
parents:
9524
diff
changeset
|
133 |
offset += len; |
13cc5e8eb9f1
6578658: Request for raw RSA (NONEwithRSA) Signature support in SunMSCAPI
vinnie
parents:
9524
diff
changeset
|
134 |
} |
13cc5e8eb9f1
6578658: Request for raw RSA (NONEwithRSA) Signature support in SunMSCAPI
vinnie
parents:
9524
diff
changeset
|
135 |
|
13cc5e8eb9f1
6578658: Request for raw RSA (NONEwithRSA) Signature support in SunMSCAPI
vinnie
parents:
9524
diff
changeset
|
136 |
// Stores the precomputed message digest value. |
13cc5e8eb9f1
6578658: Request for raw RSA (NONEwithRSA) Signature support in SunMSCAPI
vinnie
parents:
9524
diff
changeset
|
137 |
@Override |
13cc5e8eb9f1
6578658: Request for raw RSA (NONEwithRSA) Signature support in SunMSCAPI
vinnie
parents:
9524
diff
changeset
|
138 |
protected void engineUpdate(ByteBuffer byteBuffer) { |
13cc5e8eb9f1
6578658: Request for raw RSA (NONEwithRSA) Signature support in SunMSCAPI
vinnie
parents:
9524
diff
changeset
|
139 |
int len = byteBuffer.remaining(); |
13cc5e8eb9f1
6578658: Request for raw RSA (NONEwithRSA) Signature support in SunMSCAPI
vinnie
parents:
9524
diff
changeset
|
140 |
if (len <= 0) { |
13cc5e8eb9f1
6578658: Request for raw RSA (NONEwithRSA) Signature support in SunMSCAPI
vinnie
parents:
9524
diff
changeset
|
141 |
return; |
13cc5e8eb9f1
6578658: Request for raw RSA (NONEwithRSA) Signature support in SunMSCAPI
vinnie
parents:
9524
diff
changeset
|
142 |
} |
13cc5e8eb9f1
6578658: Request for raw RSA (NONEwithRSA) Signature support in SunMSCAPI
vinnie
parents:
9524
diff
changeset
|
143 |
if (offset + len > precomputedDigest.length) { |
13cc5e8eb9f1
6578658: Request for raw RSA (NONEwithRSA) Signature support in SunMSCAPI
vinnie
parents:
9524
diff
changeset
|
144 |
offset = RAW_RSA_MAX + 1; |
13cc5e8eb9f1
6578658: Request for raw RSA (NONEwithRSA) Signature support in SunMSCAPI
vinnie
parents:
9524
diff
changeset
|
145 |
return; |
13cc5e8eb9f1
6578658: Request for raw RSA (NONEwithRSA) Signature support in SunMSCAPI
vinnie
parents:
9524
diff
changeset
|
146 |
} |
13cc5e8eb9f1
6578658: Request for raw RSA (NONEwithRSA) Signature support in SunMSCAPI
vinnie
parents:
9524
diff
changeset
|
147 |
byteBuffer.get(precomputedDigest, offset, len); |
13cc5e8eb9f1
6578658: Request for raw RSA (NONEwithRSA) Signature support in SunMSCAPI
vinnie
parents:
9524
diff
changeset
|
148 |
offset += len; |
13cc5e8eb9f1
6578658: Request for raw RSA (NONEwithRSA) Signature support in SunMSCAPI
vinnie
parents:
9524
diff
changeset
|
149 |
} |
13cc5e8eb9f1
6578658: Request for raw RSA (NONEwithRSA) Signature support in SunMSCAPI
vinnie
parents:
9524
diff
changeset
|
150 |
|
13cc5e8eb9f1
6578658: Request for raw RSA (NONEwithRSA) Signature support in SunMSCAPI
vinnie
parents:
9524
diff
changeset
|
151 |
@Override |
13cc5e8eb9f1
6578658: Request for raw RSA (NONEwithRSA) Signature support in SunMSCAPI
vinnie
parents:
9524
diff
changeset
|
152 |
protected void resetDigest(){ |
13cc5e8eb9f1
6578658: Request for raw RSA (NONEwithRSA) Signature support in SunMSCAPI
vinnie
parents:
9524
diff
changeset
|
153 |
offset = 0; |
13cc5e8eb9f1
6578658: Request for raw RSA (NONEwithRSA) Signature support in SunMSCAPI
vinnie
parents:
9524
diff
changeset
|
154 |
} |
13cc5e8eb9f1
6578658: Request for raw RSA (NONEwithRSA) Signature support in SunMSCAPI
vinnie
parents:
9524
diff
changeset
|
155 |
|
13cc5e8eb9f1
6578658: Request for raw RSA (NONEwithRSA) Signature support in SunMSCAPI
vinnie
parents:
9524
diff
changeset
|
156 |
// Returns the precomputed message digest value. |
13cc5e8eb9f1
6578658: Request for raw RSA (NONEwithRSA) Signature support in SunMSCAPI
vinnie
parents:
9524
diff
changeset
|
157 |
@Override |
13cc5e8eb9f1
6578658: Request for raw RSA (NONEwithRSA) Signature support in SunMSCAPI
vinnie
parents:
9524
diff
changeset
|
158 |
protected byte[] getDigestValue() throws SignatureException { |
13cc5e8eb9f1
6578658: Request for raw RSA (NONEwithRSA) Signature support in SunMSCAPI
vinnie
parents:
9524
diff
changeset
|
159 |
if (offset > RAW_RSA_MAX) { |
13cc5e8eb9f1
6578658: Request for raw RSA (NONEwithRSA) Signature support in SunMSCAPI
vinnie
parents:
9524
diff
changeset
|
160 |
throw new SignatureException("Message digest is too long"); |
13cc5e8eb9f1
6578658: Request for raw RSA (NONEwithRSA) Signature support in SunMSCAPI
vinnie
parents:
9524
diff
changeset
|
161 |
} |
13cc5e8eb9f1
6578658: Request for raw RSA (NONEwithRSA) Signature support in SunMSCAPI
vinnie
parents:
9524
diff
changeset
|
162 |
|
13cc5e8eb9f1
6578658: Request for raw RSA (NONEwithRSA) Signature support in SunMSCAPI
vinnie
parents:
9524
diff
changeset
|
163 |
// Determine the digest algorithm from the digest length |
13cc5e8eb9f1
6578658: Request for raw RSA (NONEwithRSA) Signature support in SunMSCAPI
vinnie
parents:
9524
diff
changeset
|
164 |
if (offset == 20) { |
13cc5e8eb9f1
6578658: Request for raw RSA (NONEwithRSA) Signature support in SunMSCAPI
vinnie
parents:
9524
diff
changeset
|
165 |
setDigestName("SHA1"); |
13cc5e8eb9f1
6578658: Request for raw RSA (NONEwithRSA) Signature support in SunMSCAPI
vinnie
parents:
9524
diff
changeset
|
166 |
} else if (offset == 36) { |
13cc5e8eb9f1
6578658: Request for raw RSA (NONEwithRSA) Signature support in SunMSCAPI
vinnie
parents:
9524
diff
changeset
|
167 |
setDigestName("SHA1+MD5"); |
13cc5e8eb9f1
6578658: Request for raw RSA (NONEwithRSA) Signature support in SunMSCAPI
vinnie
parents:
9524
diff
changeset
|
168 |
} else if (offset == 32) { |
13cc5e8eb9f1
6578658: Request for raw RSA (NONEwithRSA) Signature support in SunMSCAPI
vinnie
parents:
9524
diff
changeset
|
169 |
setDigestName("SHA-256"); |
13cc5e8eb9f1
6578658: Request for raw RSA (NONEwithRSA) Signature support in SunMSCAPI
vinnie
parents:
9524
diff
changeset
|
170 |
} else if (offset == 48) { |
13cc5e8eb9f1
6578658: Request for raw RSA (NONEwithRSA) Signature support in SunMSCAPI
vinnie
parents:
9524
diff
changeset
|
171 |
setDigestName("SHA-384"); |
13cc5e8eb9f1
6578658: Request for raw RSA (NONEwithRSA) Signature support in SunMSCAPI
vinnie
parents:
9524
diff
changeset
|
172 |
} else if (offset == 64) { |
13cc5e8eb9f1
6578658: Request for raw RSA (NONEwithRSA) Signature support in SunMSCAPI
vinnie
parents:
9524
diff
changeset
|
173 |
setDigestName("SHA-512"); |
13cc5e8eb9f1
6578658: Request for raw RSA (NONEwithRSA) Signature support in SunMSCAPI
vinnie
parents:
9524
diff
changeset
|
174 |
} else if (offset == 16) { |
13cc5e8eb9f1
6578658: Request for raw RSA (NONEwithRSA) Signature support in SunMSCAPI
vinnie
parents:
9524
diff
changeset
|
175 |
setDigestName("MD5"); |
13cc5e8eb9f1
6578658: Request for raw RSA (NONEwithRSA) Signature support in SunMSCAPI
vinnie
parents:
9524
diff
changeset
|
176 |
} else { |
13cc5e8eb9f1
6578658: Request for raw RSA (NONEwithRSA) Signature support in SunMSCAPI
vinnie
parents:
9524
diff
changeset
|
177 |
throw new SignatureException( |
13cc5e8eb9f1
6578658: Request for raw RSA (NONEwithRSA) Signature support in SunMSCAPI
vinnie
parents:
9524
diff
changeset
|
178 |
"Message digest length is not supported"); |
13cc5e8eb9f1
6578658: Request for raw RSA (NONEwithRSA) Signature support in SunMSCAPI
vinnie
parents:
9524
diff
changeset
|
179 |
} |
13cc5e8eb9f1
6578658: Request for raw RSA (NONEwithRSA) Signature support in SunMSCAPI
vinnie
parents:
9524
diff
changeset
|
180 |
|
13cc5e8eb9f1
6578658: Request for raw RSA (NONEwithRSA) Signature support in SunMSCAPI
vinnie
parents:
9524
diff
changeset
|
181 |
byte[] result = new byte[offset]; |
13cc5e8eb9f1
6578658: Request for raw RSA (NONEwithRSA) Signature support in SunMSCAPI
vinnie
parents:
9524
diff
changeset
|
182 |
System.arraycopy(precomputedDigest, 0, result, 0, offset); |
13cc5e8eb9f1
6578658: Request for raw RSA (NONEwithRSA) Signature support in SunMSCAPI
vinnie
parents:
9524
diff
changeset
|
183 |
offset = 0; |
13cc5e8eb9f1
6578658: Request for raw RSA (NONEwithRSA) Signature support in SunMSCAPI
vinnie
parents:
9524
diff
changeset
|
184 |
|
13cc5e8eb9f1
6578658: Request for raw RSA (NONEwithRSA) Signature support in SunMSCAPI
vinnie
parents:
9524
diff
changeset
|
185 |
return result; |
13cc5e8eb9f1
6578658: Request for raw RSA (NONEwithRSA) Signature support in SunMSCAPI
vinnie
parents:
9524
diff
changeset
|
186 |
} |
13cc5e8eb9f1
6578658: Request for raw RSA (NONEwithRSA) Signature support in SunMSCAPI
vinnie
parents:
9524
diff
changeset
|
187 |
} |
13cc5e8eb9f1
6578658: Request for raw RSA (NONEwithRSA) Signature support in SunMSCAPI
vinnie
parents:
9524
diff
changeset
|
188 |
|
2 | 189 |
public static final class SHA1 extends RSASignature { |
190 |
public SHA1() { |
|
191 |
super("SHA1"); |
|
192 |
} |
|
193 |
} |
|
194 |
||
9524 | 195 |
public static final class SHA256 extends RSASignature { |
196 |
public SHA256() { |
|
197 |
super("SHA-256"); |
|
198 |
} |
|
199 |
} |
|
200 |
||
201 |
public static final class SHA384 extends RSASignature { |
|
202 |
public SHA384() { |
|
203 |
super("SHA-384"); |
|
204 |
} |
|
205 |
} |
|
206 |
||
207 |
public static final class SHA512 extends RSASignature { |
|
208 |
public SHA512() { |
|
209 |
super("SHA-512"); |
|
210 |
} |
|
211 |
} |
|
212 |
||
2 | 213 |
public static final class MD5 extends RSASignature { |
214 |
public MD5() { |
|
215 |
super("MD5"); |
|
216 |
} |
|
217 |
} |
|
218 |
||
219 |
public static final class MD2 extends RSASignature { |
|
220 |
public MD2() { |
|
221 |
super("MD2"); |
|
222 |
} |
|
223 |
} |
|
224 |
||
9524 | 225 |
// initialize for signing. See JCA doc |
50204
3195a713e24d
8146293: Add support for RSASSA-PSS Signature algorithm
valeriep
parents:
47216
diff
changeset
|
226 |
@Override |
2 | 227 |
protected void engineInitVerify(PublicKey key) |
228 |
throws InvalidKeyException |
|
229 |
{ |
|
230 |
// This signature accepts only RSAPublicKey |
|
231 |
if ((key instanceof java.security.interfaces.RSAPublicKey) == false) { |
|
232 |
throw new InvalidKeyException("Key type not supported"); |
|
233 |
} |
|
234 |
||
235 |
java.security.interfaces.RSAPublicKey rsaKey = |
|
236 |
(java.security.interfaces.RSAPublicKey) key; |
|
237 |
||
238 |
if ((key instanceof sun.security.mscapi.RSAPublicKey) == false) { |
|
239 |
||
240 |
// convert key to MSCAPI format |
|
241 |
||
2596 | 242 |
BigInteger modulus = rsaKey.getModulus(); |
243 |
BigInteger exponent = rsaKey.getPublicExponent(); |
|
244 |
||
245 |
// Check against the local and global values to make sure |
|
246 |
// the sizes are ok. Round up to the nearest byte. |
|
247 |
RSAKeyFactory.checkKeyLengths(((modulus.bitLength() + 7) & ~7), |
|
248 |
exponent, -1, RSAKeyPairGenerator.KEY_SIZE_MAX); |
|
249 |
||
250 |
byte[] modulusBytes = modulus.toByteArray(); |
|
251 |
byte[] exponentBytes = exponent.toByteArray(); |
|
2 | 252 |
|
253 |
// Adjust key length due to sign bit |
|
254 |
int keyBitLength = (modulusBytes[0] == 0) |
|
255 |
? (modulusBytes.length - 1) * 8 |
|
256 |
: modulusBytes.length * 8; |
|
257 |
||
258 |
byte[] keyBlob = generatePublicKeyBlob( |
|
2596 | 259 |
keyBitLength, modulusBytes, exponentBytes); |
2 | 260 |
|
9508
310b4f6c8e61
6732372: Some MSCAPI native methods not returning correct exceptions.
vinnie
parents:
9505
diff
changeset
|
261 |
try { |
310b4f6c8e61
6732372: Some MSCAPI native methods not returning correct exceptions.
vinnie
parents:
9505
diff
changeset
|
262 |
publicKey = importPublicKey(keyBlob, keyBitLength); |
310b4f6c8e61
6732372: Some MSCAPI native methods not returning correct exceptions.
vinnie
parents:
9505
diff
changeset
|
263 |
|
310b4f6c8e61
6732372: Some MSCAPI native methods not returning correct exceptions.
vinnie
parents:
9505
diff
changeset
|
264 |
} catch (KeyStoreException e) { |
310b4f6c8e61
6732372: Some MSCAPI native methods not returning correct exceptions.
vinnie
parents:
9505
diff
changeset
|
265 |
throw new InvalidKeyException(e); |
310b4f6c8e61
6732372: Some MSCAPI native methods not returning correct exceptions.
vinnie
parents:
9505
diff
changeset
|
266 |
} |
2 | 267 |
|
268 |
} else { |
|
269 |
publicKey = (sun.security.mscapi.RSAPublicKey) key; |
|
270 |
} |
|
271 |
||
9524 | 272 |
this.privateKey = null; |
273 |
resetDigest(); |
|
2 | 274 |
} |
275 |
||
9524 | 276 |
// initialize for signing. See JCA doc |
50204
3195a713e24d
8146293: Add support for RSASSA-PSS Signature algorithm
valeriep
parents:
47216
diff
changeset
|
277 |
@Override |
9524 | 278 |
protected void engineInitSign(PrivateKey key) throws InvalidKeyException |
2 | 279 |
{ |
280 |
// This signature accepts only RSAPrivateKey |
|
281 |
if ((key instanceof sun.security.mscapi.RSAPrivateKey) == false) { |
|
282 |
throw new InvalidKeyException("Key type not supported"); |
|
283 |
} |
|
284 |
privateKey = (sun.security.mscapi.RSAPrivateKey) key; |
|
285 |
||
2596 | 286 |
// Check against the local and global values to make sure |
287 |
// the sizes are ok. Round up to nearest byte. |
|
11521
d7698e6c5f51
7106773: 512 bits RSA key cannot work with SHA384 and SHA512
xuelei
parents:
10336
diff
changeset
|
288 |
RSAKeyFactory.checkKeyLengths(((privateKey.length() + 7) & ~7), |
2596 | 289 |
null, RSAKeyPairGenerator.KEY_SIZE_MIN, |
290 |
RSAKeyPairGenerator.KEY_SIZE_MAX); |
|
2 | 291 |
|
9524 | 292 |
this.publicKey = null; |
293 |
resetDigest(); |
|
294 |
} |
|
295 |
||
296 |
/** |
|
297 |
* Resets the message digest if needed. |
|
298 |
*/ |
|
9533
13cc5e8eb9f1
6578658: Request for raw RSA (NONEwithRSA) Signature support in SunMSCAPI
vinnie
parents:
9524
diff
changeset
|
299 |
protected void resetDigest() { |
2 | 300 |
if (needsReset) { |
301 |
messageDigest.reset(); |
|
302 |
needsReset = false; |
|
303 |
} |
|
304 |
} |
|
305 |
||
9533
13cc5e8eb9f1
6578658: Request for raw RSA (NONEwithRSA) Signature support in SunMSCAPI
vinnie
parents:
9524
diff
changeset
|
306 |
protected byte[] getDigestValue() throws SignatureException { |
9524 | 307 |
needsReset = false; |
308 |
return messageDigest.digest(); |
|
309 |
} |
|
310 |
||
9533
13cc5e8eb9f1
6578658: Request for raw RSA (NONEwithRSA) Signature support in SunMSCAPI
vinnie
parents:
9524
diff
changeset
|
311 |
protected void setDigestName(String name) { |
13cc5e8eb9f1
6578658: Request for raw RSA (NONEwithRSA) Signature support in SunMSCAPI
vinnie
parents:
9524
diff
changeset
|
312 |
messageDigestAlgorithm = name; |
13cc5e8eb9f1
6578658: Request for raw RSA (NONEwithRSA) Signature support in SunMSCAPI
vinnie
parents:
9524
diff
changeset
|
313 |
} |
13cc5e8eb9f1
6578658: Request for raw RSA (NONEwithRSA) Signature support in SunMSCAPI
vinnie
parents:
9524
diff
changeset
|
314 |
|
2 | 315 |
/** |
316 |
* Updates the data to be signed or verified |
|
317 |
* using the specified byte. |
|
318 |
* |
|
319 |
* @param b the byte to use for the update. |
|
320 |
* |
|
321 |
* @exception SignatureException if the engine is not initialized |
|
322 |
* properly. |
|
323 |
*/ |
|
50204
3195a713e24d
8146293: Add support for RSASSA-PSS Signature algorithm
valeriep
parents:
47216
diff
changeset
|
324 |
@Override |
2 | 325 |
protected void engineUpdate(byte b) throws SignatureException |
326 |
{ |
|
327 |
messageDigest.update(b); |
|
328 |
needsReset = true; |
|
329 |
} |
|
330 |
||
331 |
/** |
|
332 |
* Updates the data to be signed or verified, using the |
|
333 |
* specified array of bytes, starting at the specified offset. |
|
334 |
* |
|
335 |
* @param b the array of bytes |
|
336 |
* @param off the offset to start from in the array of bytes |
|
337 |
* @param len the number of bytes to use, starting at offset |
|
338 |
* |
|
339 |
* @exception SignatureException if the engine is not initialized |
|
340 |
* properly |
|
341 |
*/ |
|
50204
3195a713e24d
8146293: Add support for RSASSA-PSS Signature algorithm
valeriep
parents:
47216
diff
changeset
|
342 |
@Override |
2 | 343 |
protected void engineUpdate(byte[] b, int off, int len) |
344 |
throws SignatureException |
|
345 |
{ |
|
346 |
messageDigest.update(b, off, len); |
|
347 |
needsReset = true; |
|
348 |
} |
|
349 |
||
350 |
/** |
|
351 |
* Updates the data to be signed or verified, using the |
|
352 |
* specified ByteBuffer. |
|
353 |
* |
|
354 |
* @param input the ByteBuffer |
|
355 |
*/ |
|
50204
3195a713e24d
8146293: Add support for RSASSA-PSS Signature algorithm
valeriep
parents:
47216
diff
changeset
|
356 |
@Override |
2 | 357 |
protected void engineUpdate(ByteBuffer input) |
358 |
{ |
|
359 |
messageDigest.update(input); |
|
360 |
needsReset = true; |
|
361 |
} |
|
362 |
||
363 |
/** |
|
364 |
* Returns the signature bytes of all the data |
|
365 |
* updated so far. |
|
366 |
* The format of the signature depends on the underlying |
|
367 |
* signature scheme. |
|
368 |
* |
|
369 |
* @return the signature bytes of the signing operation's result. |
|
370 |
* |
|
371 |
* @exception SignatureException if the engine is not |
|
372 |
* initialized properly or if this signature algorithm is unable to |
|
373 |
* process the input data provided. |
|
374 |
*/ |
|
50204
3195a713e24d
8146293: Add support for RSASSA-PSS Signature algorithm
valeriep
parents:
47216
diff
changeset
|
375 |
@Override |
2 | 376 |
protected byte[] engineSign() throws SignatureException { |
377 |
||
9524 | 378 |
byte[] hash = getDigestValue(); |
2 | 379 |
|
9533
13cc5e8eb9f1
6578658: Request for raw RSA (NONEwithRSA) Signature support in SunMSCAPI
vinnie
parents:
9524
diff
changeset
|
380 |
// Omit the hash OID when generating a Raw signature |
13cc5e8eb9f1
6578658: Request for raw RSA (NONEwithRSA) Signature support in SunMSCAPI
vinnie
parents:
9524
diff
changeset
|
381 |
boolean noHashOID = this instanceof Raw; |
13cc5e8eb9f1
6578658: Request for raw RSA (NONEwithRSA) Signature support in SunMSCAPI
vinnie
parents:
9524
diff
changeset
|
382 |
|
2 | 383 |
// Sign hash using MS Crypto APIs |
384 |
||
9533
13cc5e8eb9f1
6578658: Request for raw RSA (NONEwithRSA) Signature support in SunMSCAPI
vinnie
parents:
9524
diff
changeset
|
385 |
byte[] result = signHash(noHashOID, hash, hash.length, |
9524 | 386 |
messageDigestAlgorithm, privateKey.getHCryptProvider(), |
2 | 387 |
privateKey.getHCryptKey()); |
388 |
||
389 |
// Convert signature array from little endian to big endian |
|
390 |
return convertEndianArray(result); |
|
391 |
} |
|
392 |
||
393 |
/** |
|
394 |
* Convert array from big endian to little endian, or vice versa. |
|
395 |
*/ |
|
396 |
private byte[] convertEndianArray(byte[] byteArray) |
|
397 |
{ |
|
398 |
if (byteArray == null || byteArray.length == 0) |
|
399 |
return byteArray; |
|
400 |
||
401 |
byte [] retval = new byte[byteArray.length]; |
|
402 |
||
403 |
// make it big endian |
|
404 |
for (int i=0;i < byteArray.length;i++) |
|
405 |
retval[i] = byteArray[byteArray.length - i - 1]; |
|
406 |
||
407 |
return retval; |
|
408 |
} |
|
409 |
||
410 |
/** |
|
411 |
* Sign hash using Microsoft Crypto API with HCRYPTKEY. |
|
412 |
* The returned data is in little-endian. |
|
413 |
*/ |
|
9533
13cc5e8eb9f1
6578658: Request for raw RSA (NONEwithRSA) Signature support in SunMSCAPI
vinnie
parents:
9524
diff
changeset
|
414 |
private native static byte[] signHash(boolean noHashOID, byte[] hash, |
13cc5e8eb9f1
6578658: Request for raw RSA (NONEwithRSA) Signature support in SunMSCAPI
vinnie
parents:
9524
diff
changeset
|
415 |
int hashSize, String hashAlgorithm, long hCryptProv, long hCryptKey) |
2 | 416 |
throws SignatureException; |
417 |
||
418 |
/** |
|
419 |
* Verify a signed hash using Microsoft Crypto API with HCRYPTKEY. |
|
420 |
*/ |
|
421 |
private native static boolean verifySignedHash(byte[] hash, int hashSize, |
|
422 |
String hashAlgorithm, byte[] signature, int signatureSize, |
|
423 |
long hCryptProv, long hCryptKey) throws SignatureException; |
|
424 |
||
425 |
/** |
|
426 |
* Verifies the passed-in signature. |
|
427 |
* |
|
428 |
* @param sigBytes the signature bytes to be verified. |
|
429 |
* |
|
430 |
* @return true if the signature was verified, false if not. |
|
431 |
* |
|
432 |
* @exception SignatureException if the engine is not |
|
433 |
* initialized properly, the passed-in signature is improperly |
|
434 |
* encoded or of the wrong type, if this signature algorithm is unable to |
|
435 |
* process the input data provided, etc. |
|
436 |
*/ |
|
50204
3195a713e24d
8146293: Add support for RSASSA-PSS Signature algorithm
valeriep
parents:
47216
diff
changeset
|
437 |
@Override |
2 | 438 |
protected boolean engineVerify(byte[] sigBytes) |
439 |
throws SignatureException |
|
440 |
{ |
|
9524 | 441 |
byte[] hash = getDigestValue(); |
2 | 442 |
|
443 |
return verifySignedHash(hash, hash.length, |
|
9524 | 444 |
messageDigestAlgorithm, convertEndianArray(sigBytes), |
2 | 445 |
sigBytes.length, publicKey.getHCryptProvider(), |
446 |
publicKey.getHCryptKey()); |
|
447 |
} |
|
448 |
||
449 |
/** |
|
450 |
* Sets the specified algorithm parameter to the specified |
|
451 |
* value. This method supplies a general-purpose mechanism through |
|
452 |
* which it is possible to set the various parameters of this object. |
|
453 |
* A parameter may be any settable parameter for the algorithm, such as |
|
454 |
* a parameter size, or a source of random bits for signature generation |
|
455 |
* (if appropriate), or an indication of whether or not to perform |
|
456 |
* a specific but optional computation. A uniform algorithm-specific |
|
457 |
* naming scheme for each parameter is desirable but left unspecified |
|
458 |
* at this time. |
|
459 |
* |
|
460 |
* @param param the string identifier of the parameter. |
|
461 |
* |
|
462 |
* @param value the parameter value. |
|
463 |
* |
|
464 |
* @exception InvalidParameterException if <code>param</code> is an |
|
465 |
* invalid parameter for this signature algorithm engine, |
|
466 |
* the parameter is already set |
|
467 |
* and cannot be set again, a security exception occurs, and so on. |
|
468 |
* |
|
469 |
* @deprecated Replaced by {@link |
|
470 |
* #engineSetParameter(java.security.spec.AlgorithmParameterSpec) |
|
471 |
* engineSetParameter}. |
|
472 |
*/ |
|
50204
3195a713e24d
8146293: Add support for RSASSA-PSS Signature algorithm
valeriep
parents:
47216
diff
changeset
|
473 |
@Override |
10336
0bb1999251f8
7064075: Security libraries don't build with javac -Xlint:all,-deprecation -Werror
jjg
parents:
9533
diff
changeset
|
474 |
@Deprecated |
2 | 475 |
protected void engineSetParameter(String param, Object value) |
476 |
throws InvalidParameterException |
|
477 |
{ |
|
478 |
throw new InvalidParameterException("Parameter not supported"); |
|
479 |
} |
|
480 |
||
50204
3195a713e24d
8146293: Add support for RSASSA-PSS Signature algorithm
valeriep
parents:
47216
diff
changeset
|
481 |
/** |
3195a713e24d
8146293: Add support for RSASSA-PSS Signature algorithm
valeriep
parents:
47216
diff
changeset
|
482 |
* Sets this signature engine with the specified algorithm parameter. |
3195a713e24d
8146293: Add support for RSASSA-PSS Signature algorithm
valeriep
parents:
47216
diff
changeset
|
483 |
* |
3195a713e24d
8146293: Add support for RSASSA-PSS Signature algorithm
valeriep
parents:
47216
diff
changeset
|
484 |
* @param params the parameters |
3195a713e24d
8146293: Add support for RSASSA-PSS Signature algorithm
valeriep
parents:
47216
diff
changeset
|
485 |
* |
3195a713e24d
8146293: Add support for RSASSA-PSS Signature algorithm
valeriep
parents:
47216
diff
changeset
|
486 |
* @exception InvalidAlgorithmParameterException if the given |
3195a713e24d
8146293: Add support for RSASSA-PSS Signature algorithm
valeriep
parents:
47216
diff
changeset
|
487 |
* parameter is invalid |
3195a713e24d
8146293: Add support for RSASSA-PSS Signature algorithm
valeriep
parents:
47216
diff
changeset
|
488 |
*/ |
3195a713e24d
8146293: Add support for RSASSA-PSS Signature algorithm
valeriep
parents:
47216
diff
changeset
|
489 |
@Override |
3195a713e24d
8146293: Add support for RSASSA-PSS Signature algorithm
valeriep
parents:
47216
diff
changeset
|
490 |
protected void engineSetParameter(AlgorithmParameterSpec params) |
3195a713e24d
8146293: Add support for RSASSA-PSS Signature algorithm
valeriep
parents:
47216
diff
changeset
|
491 |
throws InvalidAlgorithmParameterException |
3195a713e24d
8146293: Add support for RSASSA-PSS Signature algorithm
valeriep
parents:
47216
diff
changeset
|
492 |
{ |
3195a713e24d
8146293: Add support for RSASSA-PSS Signature algorithm
valeriep
parents:
47216
diff
changeset
|
493 |
if (params != null) { |
3195a713e24d
8146293: Add support for RSASSA-PSS Signature algorithm
valeriep
parents:
47216
diff
changeset
|
494 |
throw new InvalidAlgorithmParameterException("No parameter accepted"); |
3195a713e24d
8146293: Add support for RSASSA-PSS Signature algorithm
valeriep
parents:
47216
diff
changeset
|
495 |
} |
3195a713e24d
8146293: Add support for RSASSA-PSS Signature algorithm
valeriep
parents:
47216
diff
changeset
|
496 |
} |
2 | 497 |
|
498 |
/** |
|
499 |
* Gets the value of the specified algorithm parameter. |
|
500 |
* This method supplies a general-purpose mechanism through which it |
|
501 |
* is possible to get the various parameters of this object. A parameter |
|
502 |
* may be any settable parameter for the algorithm, such as a parameter |
|
503 |
* size, or a source of random bits for signature generation (if |
|
504 |
* appropriate), or an indication of whether or not to perform a |
|
505 |
* specific but optional computation. A uniform algorithm-specific |
|
506 |
* naming scheme for each parameter is desirable but left unspecified |
|
507 |
* at this time. |
|
508 |
* |
|
509 |
* @param param the string name of the parameter. |
|
510 |
* |
|
511 |
* @return the object that represents the parameter value, or null if |
|
512 |
* there is none. |
|
513 |
* |
|
514 |
* @exception InvalidParameterException if <code>param</code> is an |
|
515 |
* invalid parameter for this engine, or another exception occurs while |
|
516 |
* trying to get this parameter. |
|
517 |
* |
|
518 |
* @deprecated |
|
519 |
*/ |
|
50204
3195a713e24d
8146293: Add support for RSASSA-PSS Signature algorithm
valeriep
parents:
47216
diff
changeset
|
520 |
@Override |
10336
0bb1999251f8
7064075: Security libraries don't build with javac -Xlint:all,-deprecation -Werror
jjg
parents:
9533
diff
changeset
|
521 |
@Deprecated |
2 | 522 |
protected Object engineGetParameter(String param) |
523 |
throws InvalidParameterException |
|
524 |
{ |
|
525 |
throw new InvalidParameterException("Parameter not supported"); |
|
526 |
} |
|
527 |
||
528 |
/** |
|
50204
3195a713e24d
8146293: Add support for RSASSA-PSS Signature algorithm
valeriep
parents:
47216
diff
changeset
|
529 |
* Gets the algorithm parameter from this signature engine. |
3195a713e24d
8146293: Add support for RSASSA-PSS Signature algorithm
valeriep
parents:
47216
diff
changeset
|
530 |
* |
3195a713e24d
8146293: Add support for RSASSA-PSS Signature algorithm
valeriep
parents:
47216
diff
changeset
|
531 |
* @return the parameter, or null if no parameter is used. |
3195a713e24d
8146293: Add support for RSASSA-PSS Signature algorithm
valeriep
parents:
47216
diff
changeset
|
532 |
*/ |
3195a713e24d
8146293: Add support for RSASSA-PSS Signature algorithm
valeriep
parents:
47216
diff
changeset
|
533 |
@Override |
3195a713e24d
8146293: Add support for RSASSA-PSS Signature algorithm
valeriep
parents:
47216
diff
changeset
|
534 |
protected AlgorithmParameters engineGetParameters() { |
3195a713e24d
8146293: Add support for RSASSA-PSS Signature algorithm
valeriep
parents:
47216
diff
changeset
|
535 |
return null; |
3195a713e24d
8146293: Add support for RSASSA-PSS Signature algorithm
valeriep
parents:
47216
diff
changeset
|
536 |
} |
3195a713e24d
8146293: Add support for RSASSA-PSS Signature algorithm
valeriep
parents:
47216
diff
changeset
|
537 |
|
3195a713e24d
8146293: Add support for RSASSA-PSS Signature algorithm
valeriep
parents:
47216
diff
changeset
|
538 |
/** |
2 | 539 |
* Generates a public-key BLOB from a key's components. |
540 |
*/ |
|
9505
3bbc6ff8a905
6888925: SunMSCAPI's Cipher can't use RSA public keys obtained from other sources.
vinnie
parents:
5506
diff
changeset
|
541 |
// used by RSACipher |
3bbc6ff8a905
6888925: SunMSCAPI's Cipher can't use RSA public keys obtained from other sources.
vinnie
parents:
5506
diff
changeset
|
542 |
static native byte[] generatePublicKeyBlob( |
9508
310b4f6c8e61
6732372: Some MSCAPI native methods not returning correct exceptions.
vinnie
parents:
9505
diff
changeset
|
543 |
int keyBitLength, byte[] modulus, byte[] publicExponent) |
310b4f6c8e61
6732372: Some MSCAPI native methods not returning correct exceptions.
vinnie
parents:
9505
diff
changeset
|
544 |
throws InvalidKeyException; |
2 | 545 |
|
546 |
/** |
|
547 |
* Imports a public-key BLOB. |
|
548 |
*/ |
|
9505
3bbc6ff8a905
6888925: SunMSCAPI's Cipher can't use RSA public keys obtained from other sources.
vinnie
parents:
5506
diff
changeset
|
549 |
// used by RSACipher |
9508
310b4f6c8e61
6732372: Some MSCAPI native methods not returning correct exceptions.
vinnie
parents:
9505
diff
changeset
|
550 |
static native RSAPublicKey importPublicKey(byte[] keyBlob, int keySize) |
310b4f6c8e61
6732372: Some MSCAPI native methods not returning correct exceptions.
vinnie
parents:
9505
diff
changeset
|
551 |
throws KeyStoreException; |
2 | 552 |
} |