< prev index next >
src/jdk.crypto.cryptoki/share/classes/sun/security/pkcs11/P11DSAKeyFactory.java
Print this page
@@ -177,11 +177,11 @@
Session session = null;
try {
session = token.getObjSession();
long keyID = token.p11.C_CreateObject(session.id(), attributes);
return P11Key.publicKey
- (session, keyID, "DSA", p.bitLength(), attributes);
+ (session, keyID, "DSA", p.bitLength(), attributes, true);
} finally {
token.releaseSession(session);
}
}
@@ -200,11 +200,11 @@
Session session = null;
try {
session = token.getObjSession();
long keyID = token.p11.C_CreateObject(session.id(), attributes);
return P11Key.privateKey
- (session, keyID, "DSA", p.bitLength(), attributes);
+ (session, keyID, "DSA", p.bitLength(), attributes, true);
} finally {
token.releaseSession(session);
}
}
@@ -216,11 +216,16 @@
new CK_ATTRIBUTE(CKA_VALUE),
new CK_ATTRIBUTE(CKA_PRIME),
new CK_ATTRIBUTE(CKA_SUBPRIME),
new CK_ATTRIBUTE(CKA_BASE),
};
+ key.incNativeKeyRef();
+ try {
token.p11.C_GetAttributeValue(session[0].id(), key.keyID, attributes);
+ } finally {
+ key.decNativeKeyRef();
+ }
KeySpec spec = new DSAPublicKeySpec(
attributes[0].getBigInteger(),
attributes[1].getBigInteger(),
attributes[2].getBigInteger(),
attributes[3].getBigInteger()
@@ -240,11 +245,16 @@
new CK_ATTRIBUTE(CKA_VALUE),
new CK_ATTRIBUTE(CKA_PRIME),
new CK_ATTRIBUTE(CKA_SUBPRIME),
new CK_ATTRIBUTE(CKA_BASE),
};
+ key.incNativeKeyRef();
+ try {
token.p11.C_GetAttributeValue(session[0].id(), key.keyID, attributes);
+ } finally {
+ key.decNativeKeyRef();
+ }
KeySpec spec = new DSAPrivateKeySpec(
attributes[0].getBigInteger(),
attributes[1].getBigInteger(),
attributes[2].getBigInteger(),
attributes[3].getBigInteger()
< prev index next >