Uploaded image for project: 'Santuario'
  1. Santuario
  2. SANTUARIO-379

Signing XML with SHA1 with DSA throws exception when key is larger than 1024

    XMLWordPrintableJSON

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Major
    • Resolution: Fixed
    • Affects Version/s: Java 1.5.6
    • Fix Version/s: Java 1.5.7
    • Component/s: Java
    • Labels:
      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

        Attachments

          Activity

            People

            • Assignee:
              sean.mullan@oracle.com sean.mullan
              Reporter:
              m.dzhigarov Marin Dzhigarov
            • Votes:
              0 Vote for this issue
              Watchers:
              4 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: