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-27 09:20 ------- (In reply to comment #1) > (In reply to comment #0) > > Hello > > > > I am having a problem. My application is an applet that generate a xml and sign > > it with PrivateKey from SmartCard. > > > > The first time, it works fine! however when i try to sign again (second time), i > > get this exception: > > > > java.security.InvalidKeyException: Private keys must be instance of > > RSAPrivate(Crt)Key or have PKCS#8 encoding > This exception indicates that you are trying to use the key that is > stored on the smart card with a software based crypto provider. It won't work. > See http://java.sun.com/j2se/1.5.0/docs/guide/security/p11guide.html#DelayedSelect > for some more information about that. > However, we need to figure out why you are getting that exception. > > The exception occurs when calling the method: DOMSignContext dsc = new > > DOMSignContext(pk, doc.getDocumentElement()); This method is part of the > > following code: > > > > Does any body know what could i do to solve this problem ? > Can you attach the full exception stack trace? I will try to do this: "It is recommended that applications only call getProvider() after they have called the relevant initialization method. " Im using xml signature... i) Is this my initialization method "XMLSignature signature = fac.newXMLSignature(si, ki)"; ? ii) Is my getProvider() this part? "XMLSignatureFactory fac = XMLSignatureFactory.getInstance( "DOM", (Provider) Class.forName(providerName).newInstance()); Reference ref = fac.newReference( "", fac.newDigestMethod(DigestMethod.SHA1, null), Collections.singletonList(fac.newTransform( Transform.ENVELOPED, (TransformParameterSpec) null)), null, null); " ? The complete stack trace: AssinaturaXMLException: java.security.InvalidKeyException: Private keys must be instance of RSAPrivate(Crt)Key or have PKCS#8 encoding at AssinaturaXMLEnveloped.assinar(AssinaturaXMLEnveloped.java:86) at AssinadorDigital.AssinarDados(AssinadorDigital.java:133) at AssinadorDigital.btnAssinar_actionPerformed (AssinadorDigital.java:189) at AssinadorDigital_btnAssinar_actionAdapter.actionPerformed (AssinadorDigital.java:201) at javax.swing.AbstractButton.fireActionPerformed(Unknown Source) at javax.swing.AbstractButton$Handler.actionPerformed(Unknown Source) at javax.swing.DefaultButtonModel.fireActionPerformed(Unknown Source) at javax.swing.DefaultButtonModel.setPressed(Unknown Source) at javax.swing.plaf.basic.BasicButtonListener.mouseReleased(Unknown Source) at java.awt.Component.processMouseEvent(Unknown Source) at javax.swing.JComponent.processMouseEvent(Unknown Source) at java.awt.Component.processEvent(Unknown Source) at java.awt.Container.processEvent(Unknown Source) at java.awt.Component.dispatchEventImpl(Unknown Source) at java.awt.Container.dispatchEventImpl(Unknown Source) at java.awt.Component.dispatchEvent(Unknown Source) at java.awt.LightweightDispatcher.retargetMouseEvent(Unknown Source) at java.awt.LightweightDispatcher.processMouseEvent(Unknown Source) at java.awt.LightweightDispatcher.dispatchEvent(Unknown Source) at java.awt.Container.dispatchEventImpl(Unknown Source) at java.awt.Component.dispatchEvent(Unknown Source) at java.awt.EventQueue.dispatchEvent(Unknown Source) at java.awt.EventDispatchThread.pumpOneEventForHierarchy(Unknown Source) at java.awt.EventDispatchThread.pumpEventsForHierarchy(Unknown Source) at java.awt.EventDispatchThread.pumpEvents(Unknown Source) at java.awt.EventDispatchThread.pumpEvents(Unknown Source) at java.awt.EventDispatchThread.run(Unknown Source) -- 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.