changeset 14453:3ad9fa6a5a13 jdk8u252-b09 jdk8u252-ga

8204152: SignedObject throws NullPointerException for null keys with an initialized Signature object Summary: Check for null and throw InvalidKeyException to maintain same behavior Reviewed-by: xuelei
author valeriep
date Tue, 19 Jun 2018 23:33:31 +0000
parents a8f0a9ef1797
children b3db2cd0d9c4
files src/share/classes/sun/security/rsa/RSAKeyFactory.java
diffstat 1 files changed, 3 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/src/share/classes/sun/security/rsa/RSAKeyFactory.java	Thu Jan 30 01:15:13 2020 -0800
+++ b/src/share/classes/sun/security/rsa/RSAKeyFactory.java	Tue Jun 19 23:33:31 2018 +0000
@@ -115,6 +115,9 @@
      * 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)) {