mirror of
https://github.com/openjdk/jdk.git
synced 2025-08-28 15:24:43 +02:00
8205720: KeyFactory#getKeySpec and translateKey thorws NullPointerException with Invalid key
Updated SunRsaSign provider to check and throw InvalidKeyException for null key algo/format/encoding Reviewed-by: xuelei
This commit is contained in:
parent
11184615a8
commit
ecc5979769
4 changed files with 33 additions and 21 deletions
|
@ -116,6 +116,9 @@ public final class RSAPublicKeyImpl extends X509Key implements RSAPublicKey {
|
|||
* Construct a key from its encoding. Used by RSAKeyFactory.
|
||||
*/
|
||||
RSAPublicKeyImpl(byte[] encoded) throws InvalidKeyException {
|
||||
if (encoded == null || encoded.length == 0) {
|
||||
throw new InvalidKeyException("Missing key encoding");
|
||||
}
|
||||
decode(encoded); // this sets n and e value
|
||||
RSAKeyFactory.checkRSAProviderKeyLengths(n.bitLength(), e);
|
||||
checkExponentRange(n, e);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue