< 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 ****
--- 261,276 ----
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 ****
--- 292,307 ----
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 ****
--- 315,330 ----
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 >