| From | Sent On | Attachments |
|---|---|---|
| Stinson, Elizabeth | Jul 26, 2004 7:05 pm | |
| Stinson, Elizabeth | Jul 27, 2004 10:16 am | |
| Sean Mullan | Jul 27, 2004 12:44 pm |
| Subject: | RE: excl-c14n : answer for the archives | |
|---|---|---|
| From: | Stinson, Elizabeth (esti...@rsasecurity.com) | |
| Date: | Jul 27, 2004 10:16:51 am | |
| List: | net.java.dev.jwsdp.users | |
To answer my own question, appears that when using excl-c14n# or excl-c14n#With as the c14n method, one must specify non-null params.
So this works (where "fac" is the XMLSignatureFactory):
ExcC14NParameterSpec params = ExcC14NParameterSpec(); CanonicalizationMethod c14n = fac.newCanonicalizationMethod(c14nMethod,params);
Using excl-c14n or excl-c14nWith as a transform does not appear to be supported currently.
Liz Stinson
-----Original Message----- From: Stinson, Elizabeth Sent: Monday, July 26, 2004 7:06 PM To: 'use...@jwsdp.dev.java.net' Subject: excl-c14n : requires input params?
Hi,
I shouldn't need to do anything fancy in order to use excl-c14n or excl-c14n#WithComments for my c14n method for an XML dig sig, should I?
Thanks. Liz
Incidentally, what I am seeing is that an exception is thrown when the sign() method is actually called (and I'm using exclusive canonicalization or exclusive canonicalization with comments as the c14n method). Also can I use excl-c14n or excl-c14n#With as a transform method? Thanks... Liz
------------------ The relevant code: taken directly from the xmldsig samples
------------------
String providerName = System.getProperty("jsr105Provider", "org.jcp.xml.dsig.internal.dom.XMLDSigRI");
XMLSignatureFactory fac =
XMLSignatureFactory.getInstance("DOM",(Provider)Class.forName( providerName).newInstance());
ArrayList list = new ArrayList(2); list.add(fac.newTransform(Transform.ENVELOPED,null)); // if trMethod == XPATH, will need a param... list.add(fac.newTransform(trMethod,null));
javax.xml.crypto.dsig.Reference ref = fac.newReference ("#" + id, fac.newDigestMethod(SHA_DIG, null), list /* transforms */ , null, null);
------------>------------>------------>------------>------------> Having problems when the String c14nMethod == "http://www.w3.org/2001/10/xml-exc-c14n#" or "http://www.w3.org/2001/10/xml-exc-c14n#" ------------>------------>------------>------------>------------> // Create the SignedInfo javax.xml.crypto.dsig.SignedInfo si = fac.newSignedInfo
(fac.newCanonicalizationMethod(c14nMethod, null),
fac.newSignatureMethod(signatureAlg, null), Collections.singletonList(ref)); ------------>------------>------------>------------>------------>
<SNIP>
------------>------------>------------>------------>------------> The below is where the exception is thrown from: ------------>------------>------------>------------>------------> // Marshal, generate (and sign) the enveloped signature signature.sign(dsc); ------------>------------>------------>------------>------------>
============== THE EXCEPTION: ==============
java.lang.NullPointerException at org.jcp.xml.dsig.internal.dom.DOMExcC14NMethod.marshalParams(D OMExcC14NMethod.java:88) at org.jcp.xml.dsig.internal.dom.DOMTransform.marshal(DOMTransfor m.java:147) at org.jcp.xml.dsig.internal.dom.DOMSignedInfo.marshal(DOMSignedI nfo.java:209) at org.jcp.xml.dsig.internal.dom.DOMXMLSignature.marshal(DOMXMLSi gnature.java:184) at org.jcp.xml.dsig.internal.dom.DOMXMLSignature.sign(DOMXMLSigna ture.java:247) at SmallTest.generateJWSDPEnvelopedSig(SmallTest.java:457) at SmallTest.generateJWSDPSigs(SmallTest.java:315) at SmallTest.main(SmallTest.java:257)





