Hello,

when i sign hundreds of 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:646)  
        * 
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 think that some of the iText classes are messing with the provider like 
creating/removing sessions. But i can not figure out if this is true.
I though it might be Provider problem and i wrote to them, but they ensure me 
the problem is not at the provider .dll file.

If I get the private Key and use it to sign many files i got this exception:

java.security.ProviderException: Could not obtain session
    at sun.security.pkcs11.SessionManager.getOpSession(SessionManager.java:130)
    at sun.security.pkcs11.Token.getOpSession(Token.java:247)
    at sun.security.pkcs11.P11Signature.initialize(P11Signature.java:283)
    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:299)
    at org.btrust.signer.PDFSigner.signPDF(PDFSigner.java:486)
    at org.btrust.util.SignThread.run(SignThread.java:664)

The exception is thrown at line : "Signature.initSign(PrivateKey);"And this 
happens at file 100 all the time. Does someone know why?


If I create new Provider every 90 files i get the first exception i posted.
The strange is that i get the exception at different file every time, but after 
file 100. 

Seems like some classes are playing with the provider sessions!!!


 
M. Cp. Eng. Valentin Ivanov
------------------------------------------------------------------------------
Try before you buy = See our experts in action!
The most comprehensive online learning library for Microsoft developers
is just $99.99! Visual Studio, SharePoint, SQL - plus HTML5, CSS3, MVC3,
Metro Style Apps, more. Free future releases when you subscribe now!
http://p.sf.net/sfu/learndevnow-dev2
_______________________________________________
iText-questions mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/itext-questions

iText(R) is a registered trademark of 1T3XT BVBA.
Many questions posted to this list can (and will) be answered with a reference 
to the iText book: http://www.itextpdf.com/book/
Please check the keywords list before you ask for examples: 
http://itextpdf.com/themes/keywords.php

Reply via email to