JDK-6414899 : P11Digest should support cloning
  • Type: Enhancement
  • Component: security-libs
  • Sub-Component: javax.crypto:pkcs11
  • Affected Version: 6
  • Priority: P3
  • Status: Closed
  • Resolution: Fixed
  • OS: generic
  • CPU: generic
  • Submitted: 2006-04-18
  • Updated: 2017-08-29
  • Resolved: 2012-01-25
The Version table provides details related to the release that this issue/RFE will be addressed.

Unresolved : Release in which this issue/RFE will be addressed.
Resolved: Release in which this issue/RFE has been resolved.
Fixed : Release in which this issue/RFE has been fixed. The release containing this fix may be available for download as an Early Access Release or a General Availability Release.

To download the current JDK release, click here.
JDK 7 JDK 8 Other
7u131Fixed 8 b23Fixed openjdk7uFixed
Description
The P11Digest implementation should support cloning, if the underlying PKCS#11 library supports it. This means dynamically determining if the token supports C_GetOperationState() and C_SetOperationState() for digests and returning an instance of the appropriate P11Digest class as a result (that implements the Cloneable interface or that does not).

Comments
Verified on 1.8.0 b94 using regression test sun/security/pkcs11/MessageDigest/TestCloning.java
11-06-2013

webrev: http://cr.openjdk.java.net/~valeriep/6414899/
11-06-2013

written to valerie, for more details to verify this issue
02-05-2013

EVALUATION Filed 7050617 "Need C_GetOperationState()/C_SetOperationState() support for SHA-2 family of digests" against Solaris.
01-06-2011

EVALUATION While testing the changes for supporting digest cloning functionality, I observed the following exceptions for SHA-256, SHA-384, and SHA-512 against Solaris softtoken impl: java.lang.CloneNotSupportedException at sun.security.pkcs11.P11Digest.clone(P11Digest.java:337) at java.security.MessageDigest$Delegate.clone(MessageDigest.java:543) at TestCloning.doCloning(TestCloning.java:83) at TestCloning.main(TestCloning.java:54) at PKCS11Test.premain(PKCS11Test.java:69) at PKCS11Test.testDefault(PKCS11Test.java:120) at PKCS11Test.main(PKCS11Test.java:79) at TestCloning.main(TestCloning.java:43) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke(Method.java:601) at com.sun.javatest.regtest.MainWrapper$MainThread.run(MainWrapper.java:78) at java.lang.Thread.run(Thread.java:722) Caused by: sun.security.pkcs11.wrapper.PKCS11Exception: CKR_STATE_UNSAVEABLE at sun.security.pkcs11.wrapper.PKCS11.C_GetOperationState(Native Method) at sun.security.pkcs11.P11Digest.<init>(P11Digest.java:105) at sun.security.pkcs11.P11Digest.clone(P11Digest.java:335) ... 13 more May have to leave them disabled if Solaris softtoken impl does not support C_GetOperationState/C_SetOperationState() calls for these message digest algorithms.
01-06-2011

EVALUATION Right.
18-04-2006