diff --git a/src/share/classes/sun/security/rsa/RSAKeyFactory.java b/src/share/classes/sun/security/rsa/RSAKeyFactory.java index 54451256d5600afcc981cfb3cb50492ae739ff2e..021fa931829c208810ba0cd919eb3acb0dfb49b7 100644 --- a/src/share/classes/sun/security/rsa/RSAKeyFactory.java +++ b/src/share/classes/sun/security/rsa/RSAKeyFactory.java @@ -115,6 +115,9 @@ public class RSAKeyFactory extends KeyFactorySpi { * Used by RSASignature and RSACipher. */ public static RSAKey toRSAKey(Key key) throws InvalidKeyException { + if (key == null) { + throw new InvalidKeyException("Key must not be null"); + } if ((key instanceof RSAPrivateKeyImpl) || (key instanceof RSAPrivateCrtKeyImpl) || (key instanceof RSAPublicKeyImpl)) {