Verifying ENUM signatures
When an ENUM user sends us a Create command, we validate the XML against the schemas and that the XML signature chain of trust to our CA is OK. When this doesn’t work, there isn’t much feedback that we can return to the user, and it’s difficult to diagnose what caused the failure.
It’s possible to validate a signature with oXygen but all that says is “Invalid Signature” if there’s an error.
So I’ve put together some Java code which produces a bit more diagnostics; see ValidateEnumCreateJava.zip (or as a .jar file if you don’t have a Java compiler)
Before you start
I recommend doing an XML validity check first: don’t waste time trying to debug XML signature problems if you haven’t.
One way to do this is to use Sun’s Multi Schema Validator - https://msv.dev.java.net/ as suggested in the README in our schema bundles, i.e.
java -jar /path/to/msv.jsr /path/to/nom-enum-root-2.0.xsd your_file.xml
Running the ENUM signature checker
- compile as:
javac ValidateEnumCreate.java
- run as:
java ValidEnumCreate <yourfile>
or if you don’t have a Java compiler…
- run from a .jar file:
java -jar ValidEnumCreate.jar <yourfile>
Results:
Valid Signature
If all is well, the result should be
Signature Validated OK
The response for an invalid signature depends on what was wrong:
Bad DigestValue
If the digest is different but the signature of that digest is correct, the result will be
Signature 0 failed core validation: Checking that the digest matches the data: FAIL: DigestValue does not match data (Signature 0 ref[’0′] validity status: false) Checking the signature of the digest: PASS: SignatureValue verifies DigestValue (Signature 0 validation status: true)
This is possibly due to munging of whitespace. The signed XML is fragile and even sensitive to changes in whitespace between tags (I commented on this in an earlier blog article)
Bad Signature or certificate
If the signature is invalid or the wrong certificate is included, the results will be:
Signature 0 failed core validation: Checking that the digest matches the data: PASS: DigestValue matches data (Signature 0 ref[’0′] validity status: true) Checking the signature of the digest: FAIL: SignatureValue does not verify DigestValue (Signature 0 validation status: false)
Other errors
- Failure to parse the XML - error message
- Failure to decode the Digest/Signature/Certificate - Java exception + stack trace
References
http://jtute.com/java6/0904.html
http://java.sun.com/developer/technicalArticles/xml/dig_signature_api/
http://weblogs.java.net/blog/mullan/archive/2006/01/my_xml_signatur_1.html
http://weblogs.java.net/blog/2007/08/03/even-more-xml-signature-debugging-tips

(1 votes, average: 4 out of 5)