< prev index next >

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

Print this page

        

*** 195,205 **** Session session = null; try { session = token.getObjSession(); long keyID = token.p11.C_CreateObject(session.id(), attributes); return P11Key.publicKey ! (session, keyID, "RSA", n.bitLength(), attributes); } finally { token.releaseSession(session); } } --- 195,205 ---- Session session = null; try { session = token.getObjSession(); long keyID = token.p11.C_CreateObject(session.id(), attributes); return P11Key.publicKey ! (session, keyID, "RSA", n.bitLength(), attributes, true); } finally { token.releaseSession(session); } }
*** 217,227 **** Session session = null; try { session = token.getObjSession(); long keyID = token.p11.C_CreateObject(session.id(), attributes); return P11Key.privateKey ! (session, keyID, "RSA", n.bitLength(), attributes); } finally { token.releaseSession(session); } } --- 217,227 ---- Session session = null; try { session = token.getObjSession(); long keyID = token.p11.C_CreateObject(session.id(), attributes); return P11Key.privateKey ! (session, keyID, "RSA", n.bitLength(), attributes, true); } finally { token.releaseSession(session); } }
*** 247,257 **** Session session = null; try { session = token.getObjSession(); long keyID = token.p11.C_CreateObject(session.id(), attributes); return P11Key.privateKey ! (session, keyID, "RSA", n.bitLength(), attributes); } finally { token.releaseSession(session); } } --- 247,257 ---- Session session = null; try { session = token.getObjSession(); long keyID = token.p11.C_CreateObject(session.id(), attributes); return P11Key.privateKey ! (session, keyID, "RSA", n.bitLength(), attributes, true); } finally { token.releaseSession(session); } }
*** 261,271 **** session[0] = token.getObjSession(); CK_ATTRIBUTE[] attributes = new CK_ATTRIBUTE[] { new CK_ATTRIBUTE(CKA_MODULUS), new CK_ATTRIBUTE(CKA_PUBLIC_EXPONENT), }; ! token.p11.C_GetAttributeValue(session[0].id(), key.keyID, attributes); KeySpec spec = new RSAPublicKeySpec( attributes[0].getBigInteger(), attributes[1].getBigInteger() ); return keySpec.cast(spec); --- 261,277 ---- session[0] = token.getObjSession(); CK_ATTRIBUTE[] attributes = new CK_ATTRIBUTE[] { new CK_ATTRIBUTE(CKA_MODULUS), new CK_ATTRIBUTE(CKA_PUBLIC_EXPONENT), }; ! key.incNativeKeyRef(); ! try { ! token.p11.C_GetAttributeValue(session[0].id(), key.keyID, ! attributes); ! } finally { ! key.decNativeKeyRef(); ! } KeySpec spec = new RSAPublicKeySpec( attributes[0].getBigInteger(), attributes[1].getBigInteger() ); return keySpec.cast(spec);
*** 287,297 **** new CK_ATTRIBUTE(CKA_PRIME_2), new CK_ATTRIBUTE(CKA_EXPONENT_1), new CK_ATTRIBUTE(CKA_EXPONENT_2), new CK_ATTRIBUTE(CKA_COEFFICIENT), }; ! token.p11.C_GetAttributeValue(session[0].id(), key.keyID, attributes); KeySpec spec = new RSAPrivateCrtKeySpec( attributes[0].getBigInteger(), attributes[1].getBigInteger(), attributes[2].getBigInteger(), attributes[3].getBigInteger(), --- 293,309 ---- new CK_ATTRIBUTE(CKA_PRIME_2), new CK_ATTRIBUTE(CKA_EXPONENT_1), new CK_ATTRIBUTE(CKA_EXPONENT_2), new CK_ATTRIBUTE(CKA_COEFFICIENT), }; ! key.incNativeKeyRef(); ! try { ! token.p11.C_GetAttributeValue(session[0].id(), key.keyID, ! attributes); ! } finally { ! key.decNativeKeyRef(); ! } KeySpec spec = new RSAPrivateCrtKeySpec( attributes[0].getBigInteger(), attributes[1].getBigInteger(), attributes[2].getBigInteger(), attributes[3].getBigInteger(),
*** 305,315 **** session[0] = token.getObjSession(); CK_ATTRIBUTE[] attributes = new CK_ATTRIBUTE[] { new CK_ATTRIBUTE(CKA_MODULUS), new CK_ATTRIBUTE(CKA_PRIVATE_EXPONENT), }; ! token.p11.C_GetAttributeValue(session[0].id(), key.keyID, attributes); KeySpec spec = new RSAPrivateKeySpec( attributes[0].getBigInteger(), attributes[1].getBigInteger() ); return keySpec.cast(spec); --- 317,333 ---- session[0] = token.getObjSession(); CK_ATTRIBUTE[] attributes = new CK_ATTRIBUTE[] { new CK_ATTRIBUTE(CKA_MODULUS), new CK_ATTRIBUTE(CKA_PRIVATE_EXPONENT), }; ! key.incNativeKeyRef(); ! try { ! token.p11.C_GetAttributeValue(session[0].id(), key.keyID, ! attributes); ! } finally { ! key.decNativeKeyRef(); ! } KeySpec spec = new RSAPrivateKeySpec( attributes[0].getBigInteger(), attributes[1].getBigInteger() ); return keySpec.cast(spec);
< prev index next >