DO NOT REPLY TO THIS EMAIL, BUT PLEASE POST YOUR BUGĀ· RELATED COMMENTS THROUGH THE WEB INTERFACE AVAILABLE AT <http://issues.apache.org/bugzilla/show_bug.cgi?id=40826>. ANY REPLY MADE TO THIS MESSAGE WILL NOT BE COLLECTED ANDĀ· INSERTED IN THE BUG DATABASE.
http://issues.apache.org/bugzilla/show_bug.cgi?id=40826 ------- Additional Comments From [EMAIL PROTECTED] 2006-10-30 23:05 ------- I'm experiencing the same kind of weird behavior when I try to sign twice. The code does something like: Document document = loadDocument(); smartCard.open(...); // registers SunPKCS11 provider PrivateKey privateKey = smartCard.getPrivateKey(); // from the keystore xmlSign(document, privateKey, ...); smartCard.close(); // removes SunPKCS11 provider smartCard.open(...); // registers SunPKCS11 provider again PrivateKey privateKey = smartCard.getPrivateKey(); xmlSign(document, privateKey, ...); The second sign operation gives me: Caused by: org.apache.xml.security.signature.XMLSignatureException: Private key must be instance of RSAPrivate(Crt)Key or have PKCS#8 encoding Original Exception was org.apache.xml.security.signature.XMLSignatureException: Private key must be instance of RSAPrivate(Crt)Key or have PKCS#8 encoding Original Exception was java.security.InvalidKeyException: Private key must be instance of RSAPrivate(Crt)Key or have PKCS#8 encoding at org.apache.xml.security.signature.XMLSignature.sign(Unknown Source) In my smart card code it doesn't matter whether to use KeyStore.Builder builder = KeyStore.Builder.newInstance("PKCS11", this.pkcs11Provider, callbackHandlerProtection); or ...("PKCS11", null, callbackHandlerProtection); I always get the exception. The funny thing is that I can sign twice via a non-XML signature, i.e., using Signature.getInstance("SHA1withRSA"); but, when using xmlsec, it's throwing the exception. -- Configure bugmail: http://issues.apache.org/bugzilla/userprefs.cgi?tab=email ------- You are receiving this mail because: ------- You are the assignee for the bug, or are watching the assignee.