You are viewing a plain text version of this content. The canonical link for it is here.
Posted to java-user@axis.apache.org by pacow <pe...@justgive.org> on 2004/03/29 04:44:16 UTC
Significance of 'baseURI' in XMLSignature constructor
What is the significance of the variable 'baseURI' in the XMLSignature
constructor?
> ex: XMLSignature sig = new XMLSignature(doc, baseURI, XMLSignature.ALGO_ID_SIGNATURE_RSA);
>
does it affect how the document is signed? also, how does it relate to
the following attributes of the '<soapenv:Envelope..>' tag?
> env.addAttribute(Constants.URI_SOAP11_ENV, "actor", "some-uri");
> env.addAttribute(Constants.URI_SOAP11_ENV, "mustUnderstand", "1");
>
finally, what is the significance of these 2 attributes? what do they need to
refer to for the signature to be verified properly? are they even required
at all?
thanks,
-peter
Need help adding Object to Signature
Posted by pacow <pe...@justgive.org>.
I am working with a service that expects the soap:Body element of the request to be deuplicated within the signature in and Object, like so:
-------------------------------------------------------------------
<?xml version="1.0" encoding="UTF-8"?>
<Envelope>
<Header><Signature>
<SignedInfo>[SignedInfoElements]
<Reference URI="#LocalRef">[RefElements]</Reference>
</SignedInfo>
<SignatureValue>[SigValue]</SignatureValue>
<Object Id="LocalRef"><soap:Body>[BodyElements]</soap:Body></Object>
</Signature></Header>
<soap:Body>[BodyElements]</soap:Body>
</Envelope>
-------------------------------------------------------------------------
When I try to create an ObjectContainer to add to the XMLSignature I get this exception:
"org.apache.xml.security.exceptions.XMLSecurityException:
Cannot create a {http://www.w3.org/2000/09/xmldsig#}Object from a
{http://schemas.xmlsoap.org/soap/envelope/}Body element"
Am I going about this the wrong way? Any advice would be most appreciated.
-peter
Re: Significance of 'baseURI' in XMLSignature constructor/Signing
issues
Posted by Vishal Mahajan <Vi...@Sun.COM>.
Hi Peter,
pacow wrote:
>also, I have attached a copy of my SOAP request. i add a reference in
>the signature to '#Body', do i then need to add an id='Body' attribute to
>the soap:Body tag, or elsewhere?
>
Yes, you would need to add an attribute to the soap:Body element. Adding
SOAP-SEC:id="Body" attribute to soap:Body in one of the ways to do that.
It would be better than simply putting id="Body" because the former
attribute is definitely of ID type in SOAP-SEC namespace.
Vishal
>
>thanks,
>-peter
>
>p.s. - is it a problem that the 'SignatureValue' is broken across 3 lines?
>
>
>
>------------------------------------------------------------------------
>
><?xml version="1.0" encoding="UTF-8"?>
><soapenv:Envelope soapenv:mustUnderstand="1" xmlns:SOAP-SEC="http://schemas.xmlsoap.org/soap/security/2000-12" xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
> <soapenv:Header><SOAP-SEC:Signature><ds:Signature xmlns:ds="http://www.w3.org/2000/09/xmldsig#">
><ds:SignedInfo>
><ds:CanonicalizationMethod Algorithm="http://www.w3.org/TR/2001/REC-xml-c14n-20010315"/>
><ds:SignatureMethod Algorithm="http://www.w3.org/2000/09/xmldsig#rsa-sha1"/>
><ds:Reference URI="#Body">
><ds:DigestMethod Algorithm="http://www.w3.org/2000/09/xmldsig#sha1"/>
><ds:DigestValue>2jmj7l5rSw0yVb/vlWAYkK/YBwk=</ds:DigestValue>
></ds:Reference>
></ds:SignedInfo>
><ds:SignatureValue>
>CLrgbscpDCb4jRhDuvpKKIvgY1W3wARpPuvuSVvwjBqAOjiZJL/gxOsgUMHkFHitzdm4u8/zbwfn
>SCnDSvXfwg5DusPmQOK2JR5yLYSCm32FPM5c7T4flFxZZUBtU44QY2rkhXMXZqXW+vnMinY5Cfcs
>I2JQWSVA5HSsa+7C+ek=
></ds:SignatureValue>
></ds:Signature></SOAP-SEC:Signature> </soapenv:Header>
> <soapenv:Body>
> <ns1:getMRPointsWithCard soapenv:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" xmlns:ns1="urn:mraccount">
> <request href="#id0"/>
> </ns1:getMRPointsWithCard>
> <multiRef id="id0" soapenc:root="0" soapenv:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" xsi:type="ns2:MyWebService" xmlns:ns2="http://www.myservice.com/schemas/MyWebService" xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/">
> <ID xsi:type="xsd:int">7777</ID>
> <PostalCode xsi:type="xsd:string">38611</PostalCode>
> <Number xsi:type="xsd:string">592009</Number>
> <requestID xsi:type="xsd:string">TestRequestId</requestID>
> <Date xsi:type="xsd:string">03/01/2008</Date>
> <clientID xsi:type="xsd:string">TestClientID</clientID>
> </multiRef>
> </soapenv:Body>
></soapenv:Envelope>
>
>
Significance of 'baseURI' in XMLSignature constructor/Signing issues
Posted by pacow <pe...@justgive.org>.
What is the significance of the variable 'baseURI' in the XMLSignature
constructor? If I am not refefring to an external file, and there are no
relative URIs in my document, can i leave baseURI blank? or is there
some way to indicate that the generated document is the location of the
baseURI? does the baseURI affect how the document is signed?
also, I have attached a copy of my SOAP request. i add a reference in
the signature to '#Body', do i then need to add an id='Body' attribute to
the soap:Body tag, or elsewhere?
thanks,
-peter
p.s. - is it a problem that the 'SignatureValue' is broken across 3 lines?
RE: Significance of 'baseURI' in XMLSignature constructor
Posted by Richard Martin <rm...@essex.ac.uk>.
Hi peter,
With regards to the baseURI I think this is explained in the FAQ. Check it
out, if it doesn't help you might want to ask the same question on the XML
security mailing list.
http://xml.apache.org/security/Java/faq.html#baseURI
The actor and mustUnderstand attribs are explained by the w3c:
http://www.w3schools.com/SOAP/soap_header.asp?output=print
Hope this helps!
Regards,
Richard
-----Original Message-----
From: pacow [mailto:peter@justgive.org]
Sent: 29 March 2004 03:44
To: axis-user@ws.apache.org
Subject: Significance of 'baseURI' in XMLSignature constructor
What is the significance of the variable 'baseURI' in the XMLSignature
constructor?
> ex: XMLSignature sig = new XMLSignature(doc, baseURI,
XMLSignature.ALGO_ID_SIGNATURE_RSA);
>
does it affect how the document is signed? also, how does it relate to
the following attributes of the '<soapenv:Envelope..>' tag?
> env.addAttribute(Constants.URI_SOAP11_ENV, "actor", "some-uri");
> env.addAttribute(Constants.URI_SOAP11_ENV, "mustUnderstand", "1");
>
finally, what is the significance of these 2 attributes? what do they need
to
refer to for the signature to be verified properly? are they even required
at all?
thanks,
-peter