You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@santuario.apache.org by Roberto Tealdi <ro...@tin.it> on 2003/05/28 17:37:58 UTC
problems signing
Hello,
I tried to sign an example document following the code in the "CreateSignature.java" example file. I would use, for signing, an X509 certificate in format PKCS12.
I have correctly retrieved the public and private key from this certificate, and I noticed that the class of the private Key is "RSAPrivateKey".
When I call the method
sig.sign(privateKey);
I receive this exception:
Start signing
can't identify DSA private key.
org.apache.xml.security.signature.XMLSignatureException: can't identify DSA private key.
Original Exception was org.apache.xml.security.signature.XMLSignatureException:can't identify DSA private key.
Original Exception was java.security.InvalidKeyException: can't identify DSA private key.
at org.apache.xml.security.signature.XMLSignature.sign(XMLSignature.java:439)
at Prove.main(Prove.java:170)
org.apache.xml.security.signature.XMLSignatureException: can't identify DSA private key.
Original Exception was java.security.InvalidKeyException: can't identify DSA private key.
at org.apache.xml.security.algorithms.implementations.SignatureDSA.engineInitSign(SignatureDSA.java:255)
at org.apache.xml.security.algorithms.SignatureAlgorithm.initSign(SignatureAlgorithm.java:299)
at org.apache.xml.security.signature.XMLSignature.sign(XMLSignature.java:418)
at Prove.main(Prove.java:170)
java.security.InvalidKeyException: can't identify DSA private key.
at org.bouncycastle.jce.provider.DSAUtil.generatePrivateKeyParameter(DSAUtil.java:45)
at org.bouncycastle.jce.provider.JDKDSASigner.engineInitSign(JDKDSASigner.java:80)
at java.security.Signature.initSign(Signature.java:356)
at org.apache.xml.security.algorithms.implementations.SignatureDSA.engineInitSign(SignatureDSA.java:253)
at org.apache.xml.security.algorithms.SignatureAlgorithm.initSign(SignatureAlgorithm.java:299)
at org.apache.xml.security.signature.XMLSignature.sign(XMLSignature.java:418)
at Prove.main(Prove.java:170)
Does it means I cannot sign with an RSA private key?
MUST I have a DSA key?
Thank a lot for all helps.
Roberto.
Re: problems signing
Posted by Roberto Tealdi <ro...@tin.it>.
Problem solved, changed the XMLSignature algorithm property.
----- Original Message -----
From: Roberto Tealdi
To: security-dev@xml.apache.org
Sent: Wednesday, May 28, 2003 5:37 PM
Subject: problems signing
Hello,
I tried to sign an example document following the code in the "CreateSignature.java" example file. I would use, for signing, an X509 certificate in format PKCS12.
I have correctly retrieved the public and private key from this certificate, and I noticed that the class of the private Key is "RSAPrivateKey".
When I call the method
sig.sign(privateKey);
I receive this exception:
Start signing
can't identify DSA private key.
org.apache.xml.security.signature.XMLSignatureException: can't identify DSA private key.
Original Exception was org.apache.xml.security.signature.XMLSignatureException:can't identify DSA private key.
Original Exception was java.security.InvalidKeyException: can't identify DSA private key.
at org.apache.xml.security.signature.XMLSignature.sign(XMLSignature.java:439)
at Prove.main(Prove.java:170)
org.apache.xml.security.signature.XMLSignatureException: can't identify DSA private key.
Original Exception was java.security.InvalidKeyException: can't identify DSA private key.
at org.apache.xml.security.algorithms.implementations.SignatureDSA.engineInitSign(SignatureDSA.java:255)
at org.apache.xml.security.algorithms.SignatureAlgorithm.initSign(SignatureAlgorithm.java:299)
at org.apache.xml.security.signature.XMLSignature.sign(XMLSignature.java:418)
at Prove.main(Prove.java:170)
java.security.InvalidKeyException: can't identify DSA private key.
at org.bouncycastle.jce.provider.DSAUtil.generatePrivateKeyParameter(DSAUtil.java:45)
at org.bouncycastle.jce.provider.JDKDSASigner.engineInitSign(JDKDSASigner.java:80)
at java.security.Signature.initSign(Signature.java:356)
at org.apache.xml.security.algorithms.implementations.SignatureDSA.engineInitSign(SignatureDSA.java:253)
at org.apache.xml.security.algorithms.SignatureAlgorithm.initSign(SignatureAlgorithm.java:299)
at org.apache.xml.security.signature.XMLSignature.sign(XMLSignature.java:418)
at Prove.main(Prove.java:170)
Does it means I cannot sign with an RSA private key?
MUST I have a DSA key?
Thank a lot for all helps.
Roberto.