< prev index next >
src/jdk.crypto.cryptoki/share/classes/sun/security/pkcs11/P11DHKeyFactory.java
Print this page
@@ -182,11 +182,11 @@
Session session = null;
try {
session = token.getObjSession();
long keyID = token.p11.C_CreateObject(session.id(), attributes);
return P11Key.publicKey
- (session, keyID, "DH", p.bitLength(), attributes);
+ (session, keyID, "DH", p.bitLength(), attributes, true);
} finally {
token.releaseSession(session);
}
}
@@ -204,11 +204,11 @@
Session session = null;
try {
session = token.getObjSession();
long keyID = token.p11.C_CreateObject(session.id(), attributes);
return P11Key.privateKey
- (session, keyID, "DH", p.bitLength(), attributes);
+ (session, keyID, "DH", p.bitLength(), attributes, true);
} finally {
token.releaseSession(session);
}
}
@@ -219,11 +219,16 @@
CK_ATTRIBUTE[] attributes = new CK_ATTRIBUTE[] {
new CK_ATTRIBUTE(CKA_VALUE),
new CK_ATTRIBUTE(CKA_PRIME),
new CK_ATTRIBUTE(CKA_BASE),
};
+ key.incNativeKeyRef();
+ try {
token.p11.C_GetAttributeValue(session[0].id(), key.keyID, attributes);
+ } finally {
+ key.decNativeKeyRef();
+ }
KeySpec spec = new DHPublicKeySpec(
attributes[0].getBigInteger(),
attributes[1].getBigInteger(),
attributes[2].getBigInteger()
);
@@ -241,11 +246,16 @@
CK_ATTRIBUTE[] attributes = new CK_ATTRIBUTE[] {
new CK_ATTRIBUTE(CKA_VALUE),
new CK_ATTRIBUTE(CKA_PRIME),
new CK_ATTRIBUTE(CKA_BASE),
};
+ key.incNativeKeyRef();
+ try {
token.p11.C_GetAttributeValue(session[0].id(), key.keyID, attributes);
+ } finally {
+ key.decNativeKeyRef();
+ }
KeySpec spec = new DHPrivateKeySpec(
attributes[0].getBigInteger(),
attributes[1].getBigInteger(),
attributes[2].getBigInteger()
);
< prev index next >