< prev index next >

src/jdk.crypto.cryptoki/share/classes/sun/security/pkcs11/P11RSAKeyFactory.java

Print this page

        

@@ -1,7 +1,7 @@
 /*
- * Copyright (c) 2003, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2003, 2018, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
  * under the terms of the GNU General Public License version 2 only, as
  * published by the Free Software Foundation.  Oracle designates this

@@ -29,10 +29,11 @@
 
 import java.security.*;
 import java.security.interfaces.*;
 import java.security.spec.*;
 
+import sun.security.rsa.RSAPublicKeyImpl;
 import static sun.security.pkcs11.TemplateManager.*;
 import sun.security.pkcs11.wrapper.*;
 import static sun.security.pkcs11.wrapper.PKCS11Constants.*;
 
 import sun.security.rsa.RSAKeyFactory;

@@ -58,11 +59,11 @@
                     rsaKey.getPublicExponent()
                 );
             } else if ("X.509".equals(key.getFormat())) {
                 // let SunRsaSign provider parse for us, then recurse
                 byte[] encoded = key.getEncoded();
-                key = new sun.security.rsa.RSAPublicKeyImpl(encoded);
+                key = RSAPublicKeyImpl.newKey(encoded);
                 return implTranslatePublicKey(key);
             } else {
                 throw new InvalidKeyException("PublicKey must be instance "
                         + "of RSAPublicKey or have X.509 encoding");
             }

@@ -111,11 +112,11 @@
             throws InvalidKeySpecException {
         token.ensureValid();
         if (keySpec instanceof X509EncodedKeySpec) {
             try {
                 byte[] encoded = ((X509EncodedKeySpec)keySpec).getEncoded();
-                PublicKey key = new sun.security.rsa.RSAPublicKeyImpl(encoded);
+                PublicKey key = RSAPublicKeyImpl.newKey(encoded);
                 return implTranslatePublicKey(key);
             } catch (InvalidKeyException e) {
                 throw new InvalidKeySpecException
                         ("Could not create RSA public key", e);
             }
< prev index next >