> From: Edwin Dankert [mailto:[EMAIL PROTECTED] 
> Sent: Wednesday, July 05, 2006 10:52 AM
> To: Garett Shulman
> Cc: dom4j-user@lists.sourceforge.net
> Subject: Re: [dom4j-user] dom4j & XMLSignatures

> I don't think so (since base 64 should be encoded using ASCII) but it
> might have something to do with it, could you give a little more
> information about your code and a little more about the XML?

Sure...

Here is the code that creates the enveloped signature:

Document doc = m_myroot.getOwnerDocument();

XMLSignature m_xmlSignature = new XMLSignature(doc, null,  
  "http://www.w3.org/2000/09/xmldsig#rsa-sha1";,   
  "http://www.w3.org/2001/10/xml-exc-c14n#";);

appendSignatureElement(m_xmlSignature.getElement());

Transforms transforms = new Transforms(doc);
 
transforms.addTransform("http://www.w3.org/2000/09/xmldsig#enveloped
    signature");

transforms.addTransform("http://www.w3.org/2001/10/xml-exc-c14n#";);

m_xmlSignature.addDocument("", transforms,
    "http://www.w3.org/2000/09/xmldsig#sha1";);

And here is the code I am using to convert the Document to a String and
back:

domreader.read((Document)m_myroot.getOwnerDocument()).write(stringwriter
);

lcsa.addContext(URLEncoder.encode(key, "UTF-8"),
stringwriter.toString());

String xml_string =
 
domreader.read((Document)assertion_element.getOwnerDocument()).asXML();

m_myroot =
 
domwriter.write(DocumentHelper.parseText(xml_string)).getDocumentElement
();

I'm not sure what information might be useful about the XML itself. It
seems to me that the characters in the SignatureValue that are getting
represented as \n would be represented in a more parser friendly fashion
if the SignatureValue where base64 encoded. From googleing it seems to
me that SignatureValue data should be base64 encoded. Is dom4j supposed
to support this or is it my responsibility to parse out the
SignatureValue from the XML String and base64 encode it myself? Thanks
for you help. -Garett

Using Tomcat but need to do more? Need to support web services, security?
Get stuff done quickly with pre-integrated technology to make your job easier
Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642
_______________________________________________
dom4j-user mailing list
dom4j-user@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/dom4j-user

Reply via email to