Skip to Main Content

Java Security

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

Interested in getting your voice heard by members of the Developer Marketing team at Oracle? Check out this post for AppDev or this post for AI focus group information.

PKCS11 provider session count bug

ValentinoJan 18 2012 — edited Feb 13 2012
Hello,

when I am trying to sign many PDF files i got this exception:

java.security.ProviderException: Initialization failed
at sun.security.pkcs11.P11Signature.initialize(P11Signature.java:294)
at sun.security.pkcs11.P11Signature.engineInitSign(P11Signature.java:375)
at java.security.Signature$Delegate.engineInitSign(Unknown Source)
at java.security.Signature.initSign(Unknown Source)
at org.btrust.signer.PDFSigner.initSignPDF(PDFSigner.java:298)
at org.btrust.signer.PDFSigner.signPDF(PDFSigner.java:484)
at org.btrust.util.SignThread.run(SignThread.java:648)
Caused by: sun.security.pkcs11.wrapper.PKCS11Exception: CKR_SESSION_COUNT
at sun.security.pkcs11.wrapper.PKCS11.C_OpenSession(Native Method)
at sun.security.pkcs11.SessionManager.openSession(SessionManager.java:185)
at sun.security.pkcs11.SessionManager.getOpSession(SessionManager.java:123)
at sun.security.pkcs11.Token.getOpSession(Token.java:247)
at sun.security.pkcs11.P11Signature.initialize(P11Signature.java:283)
+... 6 more+

I got this error every time at a different file, sometimes at file 250, sometimes at file 400.

Basically I do make a new provider and take the private key from the Smart Card with that new provider. If i do not do this i got exception every time at file 99 , because the maximum session count is reached.
I have no idea what this exception is for, and why every time i got it at different file. I don't know what CKR_SESSION_COUNT is! SessionManager is invisible and no methods are available to manually manage the sessions to the smart card. Why is this provider so restricted.
There is even a BUG reported HERE
I really hope someone of all you guys have already been down this road.
As you can see the exception is at at java.security.Signature.initSign(Unknown Source) . Have no idea why that happened. And even more, why i can sign 200 files and at some point it fails. What can I do?
Thank you a lot in advance

Edited by: 908737 on Jan 19, 2012 6:55 AM
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Mar 12 2012
Added on Jan 18 2012
1 comment
2,591 views