Details
-
Bug
-
Status: Closed
-
Major
-
Resolution: Fixed
-
Java 1.5.6
-
None
Description
Getting the following exception when trying to sign xml document with SHA1 with DSA key that is 2048 bits long:
Exception in thread "main" java.lang.RuntimeException: A problem occured when trying to sign the document
at XMLSignTest$XMLDSIGGenerator.signXMLDocument(XMLSignTest.java:113)
at XMLSignTest.main(XMLSignTest.java:61)
Caused by: org.apache.xml.security.signature.XMLSignatureException: Invalid ASN.1 format of DSA signature
Original Exception was java.io.IOException: Invalid ASN.1 format of DSA signature
at org.apache.xml.security.algorithms.implementations.SignatureDSA.engineSign(SignatureDSA.java:160)
at org.apache.xml.security.algorithms.SignatureAlgorithm.sign(SignatureAlgorithm.java:173)
at org.apache.xml.security.signature.XMLSignature.sign(XMLSignature.java:614)
at XMLSignTest$XMLDSIGGenerator.signXMLDocument(XMLSignTest.java:109)
... 1 more
Caused by: java.io.IOException: Invalid ASN.1 format of DSA signature
at org.apache.xml.security.algorithms.implementations.SignatureDSA.convertASN1toXMLDSIG(SignatureDSA.java:284)
at org.apache.xml.security.algorithms.implementations.SignatureDSA.engineSign(SignatureDSA.java:158)
... 4 more
See attached eclipse demo project for reproducing, keystore and xml file:
https://drive.google.com/file/d/0B8qrjQTbDPd3Sld2bW5ncTlLQms/edit?usp=sharing