You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@santuario.apache.org by Francisco Sepulveda <sh...@hotmail.com> on 2008/01/08 20:13:29 UTC
doubt with enveloped signature concept
Hello, I'm having problems with respect to what i understand about the concept of an "enveloped signature"
The W3C define the signature as "The signature is over the XML content that contains the signature as an element. The content provides the root XML document element. Obviously, enveloped signatures must take care not to include their own value in the calculation of the SignatureValue"
I have seen that the following xml document has a broad acceptation as a typical use of digital signature .... the classic enveloped signature of the whole document
<document>
<element>
</element>
<signature>
<SignedInfo>
...
<Reference URI="">
<Transforms>
<Transform Algorithm=http://www.w3.org/2000/09/xmldsig#enveloped-signature/>
</Transforms>
<DigestMethod .../>
<DigestValue> .... </DigestValue>
</Reference>
</SignedInfo>
...
</signature></document>
In the above example, there is clear for me that the signature is child of the xml content being signed.
But i read in a book from McGrawHill an it shows this example of a signature that is enveloped, enveloping and detached...
<Contract1>
<ImportantContent Id="ImportantElement">
This is important content!
</ImportantContent>
<Signature Id="ThreeTypes">
<SignedInfo>
<Reference URI="http://www.remote-server.com/file.doc">
. . .
</Reference>
<Reference URI="#contract2">
. . .
</Reference>
<Reference URI="#ImportantElement">
. . .
</Reference>
</SignedInfo>
<SignatureValue> . . . </SignatureValue>
<Object Id="contract2">
<Contract2> This is also very important content! </Contract2>
</Object>
</Signature>
</Contract1>
FOR ME, the detached and enveloping signature are REALLY clear, but i have doubt about the enveloped signature .... the book said
"The Signature Element is enveloped by the <Contract1> element. This particular association gives the XML Signature the enveloped property"
So, that is my point, maybe i'm wrong but for me the <Reference URI="#ImportantElement"> is a detached signature or not???
My final question is, if a really want to sign the <ImportantContent> element using an enveloped signature. Do i really need to put the signature as child of the <ImportantContent> element or not?? does the location of the signature have a significant impact? or when the signature is enveloped it is allways located as the "last child" of the document element inside an XML document..
=(
_________________________________________________________________
Express yourself instantly with MSN Messenger! Download today it's FREE!
http://messenger.msn.click-url.com/go/onm00200471ave/direct/01/
Re: doubt with enveloped signature concept
Posted by Sean Mullan <Se...@Sun.COM>.
Francisco Sepulveda wrote:
> I'm sorry Sean for bothering you ...
>
> I have just figure out that one specify that in the DOMSignContext part
> of the code ... =)
Correct.
> I'm sure that using the getElementByID method of the Document class is a
> good point to start right?
>
> ... So far i did that but i get Exception in thread "main"
> java.lang.NullPointerException: parent cannot be null
>
> That is because i must use an xml schema to demostrate that the ID
> attribute is a valid "ID Attribute" for the
> xml document being signed?
Correct, or you need to use some other way to locate that element. If
you don't use a schema, you will need to also manually register the
element with the ID attribute by calling the setIdAttributeNS method of
DOMSignContext. This will allow the implementation to resolve the
Reference URI.
--Sean
RE: doubt with enveloped signature concept
Posted by Francisco Sepulveda <sh...@hotmail.com>.
I'm sorry Sean for bothering you ...
I have just figure out that one specify that in the DOMSignContext part of the code ... =)
I'm sure that using the getElementByID method of the Document class is a good point to start right?
... So far i did that but i get Exception in thread "main" java.lang.NullPointerException: parent cannot be null
That is because i must use an xml schema to demostrate that the ID attribute is a valid "ID Attribute" for the
xml document being signed?
Thanks in advance
Francisco
From: shepu_2002@hotmail.comTo: security-dev@xml.apache.orgSubject: RE: doubt with enveloped signature conceptDate: Wed, 9 Jan 2008 01:26:10 +0000
Hi Sean Yes, i have seen the code. In the example you showed the signature was enveloped with respect to the document element right?? (because og the Reference URI=""). the <Envelope> tis the document element right ?? <pre><code> are not xml element i think... or if their are element the signature will not be enveloped... Sorry my basics questions ... but when you said "You do have to specify where you want the Signature element to be located" how do you do that in the code that you point me??? how do you say i want the sinature inside "that" element .... i have been looking the API and i have not found that option so far =( Thanks Francisco
> Date: Tue, 8 Jan 2008 17:58:55 -0500> From: Sean.Mullan@Sun.COM> Subject: Re: doubt with enveloped signature concept> To: security-dev@xml.apache.org> > Francisco Sepulveda wrote:> > my point is ... let's suppose that i get the following XML document as input> > > > <doc> > > <element id="123">> > </signature>> > </element>> > </doc> > > > > so if i have to create an enveloped signature for the element "element"> > > > the result should be the following rigth?> > > > <doc> > > <element id="123">> > <signature>> > .....> > <reference URI="#123">> > </signature>> > </element>> > </doc> > > Yes.> > > Using the java API (javax.xml.crypto.dsig) i will have to construct the > > output xml document showed above with the signature ??? let say using a > > DocumentBuilderFactory instance and the createElement method or there > > is a transparent way for the programmer to put the signature element > > inside the element "element"?? just using the Reference, SignedInfo and > > the rest of the traditional classes...?> > You do have to specify where you want the Signature element to be > located. The implementation will do the rest of the work of creating the > Signature element and inserting it in the document. Have you looked at > the example (also in the XMLSec download) of creating an enveloped > signature?> > http://svn.apache.org/viewvc/xml/security/trunk/src_samples/javax/xml/crypto/dsig/samples/GenEnveloped.java?revision=375655&view=markup> > --Sean
Express yourself instantly with MSN Messenger! MSN Messenger
_________________________________________________________________
Express yourself instantly with MSN Messenger! Download today it's FREE!
http://messenger.msn.click-url.com/go/onm00200471ave/direct/01/
RE: doubt with enveloped signature concept
Posted by Francisco Sepulveda <sh...@hotmail.com>.
Hi Sean
Yes, i have seen the code. In the example you showed the signature was enveloped with respect to the document element right?? (because og the Reference URI=""). the <Envelope> tis the document element right ?? <pre><code> are not xml element i think... or if their are element the signature will not be enveloped...
Sorry my basics questions ... but when you said "You do have to specify where you want the Signature element to be located" how do you do that in the code that you point me??? how do you say i want the sinature inside "that" element .... i have been looking the API and i have not found that option so far =(
Thanks
Francisco
> Date: Tue, 8 Jan 2008 17:58:55 -0500> From: Sean.Mullan@Sun.COM> Subject: Re: doubt with enveloped signature concept> To: security-dev@xml.apache.org> > Francisco Sepulveda wrote:> > my point is ... let's suppose that i get the following XML document as input> > > > <doc> > > <element id="123">> > </signature>> > </element>> > </doc> > > > > so if i have to create an enveloped signature for the element "element"> > > > the result should be the following rigth?> > > > <doc> > > <element id="123">> > <signature>> > .....> > <reference URI="#123">> > </signature>> > </element>> > </doc> > > Yes.> > > Using the java API (javax.xml.crypto.dsig) i will have to construct the > > output xml document showed above with the signature ??? let say using a > > DocumentBuilderFactory instance and the createElement method or there > > is a transparent way for the programmer to put the signature element > > inside the element "element"?? just using the Reference, SignedInfo and > > the rest of the traditional classes...?> > You do have to specify where you want the Signature element to be > located. The implementation will do the rest of the work of creating the > Signature element and inserting it in the document. Have you looked at > the example (also in the XMLSec download) of creating an enveloped > signature?> > http://svn.apache.org/viewvc/xml/security/trunk/src_samples/javax/xml/crypto/dsig/samples/GenEnveloped.java?revision=375655&view=markup> > --Sean
_________________________________________________________________
Express yourself instantly with MSN Messenger! Download today it's FREE!
http://messenger.msn.click-url.com/go/onm00200471ave/direct/01/
Re: doubt with enveloped signature concept
Posted by Sean Mullan <Se...@Sun.COM>.
Francisco Sepulveda wrote:
> my point is ... let's suppose that i get the following XML document as input
>
> <doc>
> <element id="123">
> </signature>
> </element>
> </doc>
>
> so if i have to create an enveloped signature for the element "element"
>
> the result should be the following rigth?
>
> <doc>
> <element id="123">
> <signature>
> .....
> <reference URI="#123">
> </signature>
> </element>
> </doc>
Yes.
> Using the java API (javax.xml.crypto.dsig) i will have to construct the
> output xml document showed above with the signature ??? let say using a
> DocumentBuilderFactory instance and the createElement method or there
> is a transparent way for the programmer to put the signature element
> inside the element "element"?? just using the Reference, SignedInfo and
> the rest of the traditional classes...?
You do have to specify where you want the Signature element to be
located. The implementation will do the rest of the work of creating the
Signature element and inserting it in the document. Have you looked at
the example (also in the XMLSec download) of creating an enveloped
signature?
http://svn.apache.org/viewvc/xml/security/trunk/src_samples/javax/xml/crypto/dsig/samples/GenEnveloped.java?revision=375655&view=markup
--Sean
RE: doubt with enveloped signature concept
Posted by Francisco Sepulveda <sh...@hotmail.com>.
thank you Sean for you time, i was almost getting crazy because all the theory was collapsing in my mind ahahah because of the example of the book...
I'm using the xmlsec java classes to sign documents ... i have to develop classes that support different kind of signatures...
my point is ... let's suppose that i get the following XML document as input
<doc>
<element id="123">
</signature>
</element>
</doc>
so if i have to create an enveloped signature for the element "element"
the result should be the following rigth?
<doc>
<element id="123">
<signature>
.....
<reference URI="#123">
</signature>
</element>
</doc>
Using the java API (javax.xml.crypto.dsig) i will have to construct the output xml document showed above with the signature ??? let say using a DocumentBuilderFactory instance and the createElement method or there is a transparent way for the programmer to put the signature element inside the element "element"?? just using the Reference, SignedInfo and the rest of the traditional classes...?
Is my question a common application of digital signature ??? or am i completely lost ???.... i am and undergraduate student working for his bachelor and this is an investigation thesis so i'm laying the rules for secure standar communications ..... =(
Thanks Again
Francisco> Date: Tue, 8 Jan 2008 14:30:00 -0500> From: Sean.Mullan@Sun.COM> Subject: Re: doubt with enveloped signature concept> To: security-dev@xml.apache.org> > Francisco Sepulveda wrote:> > Hello, I'm having problems with respect to what i understand about the > > concept of an "enveloped signature"> > > > The W3C define the signature as /"The signature is over the XML content > > that contains the signature as an element. The content provides the root > > XML document element. Obviously, enveloped signatures must take care not > > to include their own value in the calculation of the |SignatureValue|"/> > > > I have seen that the following xml document has a broad acceptation as a > > typical use of digital signature .... the classic enveloped signature of > > the whole document> > > > <document>> > <element>> > </element>> > <signature>> > <SignedInfo>> > ...> > <Reference URI="">> > <Transforms>> > <Transform > > Algorithm=http://www.w3.org/2000/09/xmldsig#enveloped-signature/>> > </Transforms>> > <DigestMethod .../>> > <DigestValue> .... </DigestValue>> > </Reference>> > </SignedInfo>> > ...> > </signature>> > </document>> > > > In the above example, there is clear for me that the signature is child > > of the xml content being signed.> > > > But i read in a book from McGrawHill an it shows this example of a > > signature that is enveloped, enveloping and detached...> > > > * *> > > > *<Contract1>*> > > > * <ImportantContent Id="ImportantElement">*> > > > * This is important content!*> > > > * </ImportantContent>*> > > > * *> > > > * <Signature Id="ThreeTypes">*> > > > * <SignedInfo>*> > > > * <Reference > > URI=**"http://www.remote-server.com/file.doc">*> > > > * . . .*> > > > * </Reference>*> > > > * <Reference URI=**"#contract2">*> > > > * . . .*> > > > * </Reference>*> > > > * <Reference URI=**"#ImportantElement">*> > > > * . . .*> > > > * </Reference>*> > > > * </SignedInfo>*> > > > * <SignatureValue> . . . </SignatureValue>*> > > > * <Object Id="contract2">*> > > > * <Contract2> This is also very important > > content! </Contract2>*> > > > * </Object>*> > > > * </Signature>*> > > > *</Contract1>*> > > > * *> > > > *FOR ME, the detached and enveloping signature are REALLY clear, but i > > have doubt about the enveloped signature .... the book said*> > > > * *> > > > *"The Signature Element is enveloped by the <Contract1> element. This > > particular association gives the XML Signature the enveloped property"*> > > > * *> > > > * *> > > > > > So, that is my point, maybe i'm wrong but for me the <Reference > > URI=*"#ImportantElement"> is a detached signature or not???*> > Based on the example above, you're right and the book is wrong. If in > the example above, the ImportantElement ID was an attribute of the > Content element then it would be enveloped. It might be nice to send the > author a comment about that.> > > > > My final question is, if a really want to sign the <ImportantContent> > > element using an enveloped signature. Do i really need to put the > > signature as child of the <ImportantContent> element or not?? does the > > location of the signature have a significant impact? > > Yes, otherwise it is not an enveloped signature.> > > or when the > > signature is enveloped it is allways located as the "last child" of the > > document element inside an XML document..> > It doesn't have to be the last child, it could be the first, the second, > or any descendant element.> > --Sean
_________________________________________________________________
Express yourself instantly with MSN Messenger! Download today it's FREE!
http://messenger.msn.click-url.com/go/onm00200471ave/direct/01/
Re: doubt with enveloped signature concept
Posted by Sean Mullan <Se...@Sun.COM>.
Michael McIntosh wrote:
> Francisco Sepulveda <sh...@hotmail.com> wrote on 01/08/2008 02:55:46
> PM:
>
>> Michael, if i understand right the http://www.remote-server.com/file.doc
>> by definition (w3c) is a detached signature because it point to a
>> "thing" located external to the signature itself
>
> "Enveloped or enveloping signatures are over data within the same XML
> document as the signature; detached: signatures are over data external to
> the signature element."
>
> The problem is that you do not know whether file.doc is the XML document
> containing the Signature. Essentially:
> <Reference URI="http://www.remote-server.com/file.doc">
> might be equivalent to:
> <Reference URI="">
In that case, there should also be an explicit XPath Transform that
removes the Signature element from the document before it is
canonicalized and digested. I don't think you can use the Enveloped
Transform because (I think) it requires the input to be a node-set of
the Signature's document.
--Sean
RE: doubt with enveloped signature concept
Posted by Michael McIntosh <mi...@us.ibm.com>.
Francisco Sepulveda <sh...@hotmail.com> wrote on 01/08/2008 02:55:46
PM:
> Michael, if i understand right the http://www.remote-server.com/file.doc
> by definition (w3c) is a detached signature because it point to a
> "thing" located external to the signature itself
"Enveloped or enveloping signatures are over data within the same XML
document as the signature; detached: signatures are over data external to
the signature element."
The problem is that you do not know whether file.doc is the XML document
containing the Signature. Essentially:
<Reference URI="http://www.remote-server.com/file.doc">
might be equivalent to:
<Reference URI="">
>
> Francisco
>
>
>
>
>
>
>
> > Subject: Re: doubt with enveloped signature concept
> > To: security-dev@xml.apache.org
> > CC: Sean.Mullan@Sun.COM; security-dev@xml.apache.org
> > From: mikemci@us.ibm.com
> > Date: Tue, 8 Jan 2008 14:48:52 -0500
> >
> > Sean.Mullan@Sun.COM wrote on 01/08/2008 02:30:00 PM:
> >
> > > Francisco Sepulveda wrote:
> > > > Hello, I'm having problems with respect to what i understand about
the
> > > > concept of an "enveloped signature"
> > > >
> > > > The W3C define the signature as /"The signature is over the XML
content
> >
> > > > that contains the signature as an element. The content provides the
> > root
> > > > XML document element. Obviously, enveloped signatures must take
care
> > not
> > > > to include their own value in the calculation of the |
SignatureValue|"/
> > > >
> > > > I have seen that the following xml document has a broad acceptation
as
> > a
> > > > typical use of digital signature .... the classic enveloped
signature
> > of
> > > > the whole document
> > > >
> > > > <document>
> > > > <element>
> > > > </element>
> > > > <signature>
> > > > <SignedInfo>
> > > > ...
> > > > <Reference URI="">
> > > > <Transforms>
> > > > <Transform
> > > > Algorithm=http://www.w3.org/2000/09/xmldsig#enveloped-signature/>
> > > > </Transforms>
> > > > <DigestMethod .../>
> > > > <DigestValue> .... </DigestValue>
> > > > </Reference>
> > > > </SignedInfo>
> > > > ...
> > > > </signature>
> > > > </document>
> > > >
> > > > In the above example, there is clear for me that the signature is
child
> >
> > > > of the xml content being signed.
> > > >
> > > > But i read in a book from McGrawHill an it shows this example of a
> > > > signature that is enveloped, enveloping and detached...
> > > >
> > > > * *
> > > >
> > > > *<Contract1>*
> > > >
> > > > * <ImportantContent Id="ImportantElement">*
> > > >
> > > > * This is important content!*
> > > >
> > > > * </ImportantContent>*
> > > >
> > > > * *
> > > >
> > > > * <Signature Id="ThreeTypes">*
> > > >
> > > > * <SignedInfo>*
> > > >
> > > > * <Reference
> > > > URI=**"http://www.remote-server.com/file.doc">*
> > > >
> > > > * . . .*
> > > >
> > > > * </Reference>*
> > > >
> > > > * <Reference URI=**"#contract2">*
> > > >
> > > > * . . .*
> > > >
> > > > * </Reference>*
> > > >
> > > > * <Reference URI=**"#ImportantElement">*
> > > >
> > > > * . . .*
> > > >
> > > > * </Reference>*
> > > >
> > > > * </SignedInfo>*
> > > >
> > > > * <SignatureValue> . . . </SignatureValue>*
> > > >
> > > > * <Object Id="contract2">*
> > > >
> > > > * <Contract2> This is also very important
> > > > content! </Contract2>*
> > > >
> > > > * </Object>*
> > > >
> > > > * </Signature>*
> > > >
> > > > *</Contract1>*
> > > >
> > > > * *
> > > >
> > > > *FOR ME, the detached and enveloping signature are REALLY clear,
but i
> > > > have doubt about the enveloped signature .... the book said*
> > > >
> > > > * *
> > > >
> > > > *"The Signature Element is enveloped by the <Contract1> element.
This
> > > > particular association gives the XML Signature the enveloped
property"*
> > > >
> > > > * *
> > > >
> > > > * *
> > > >
> > > >
> > > > So, that is my point, maybe i'm wrong but for me the <Reference
> > > > URI=*"#ImportantElement"> is a detached signature or not???*
> > >
> > > Based on the example above, you're right and the book is wrong. If in
> > > the example above, the ImportantElement ID was an attribute of the
> > > Content element then it would be enveloped. It might be nice to send
the
> > > author a comment about that.
> >
> > I think there is a misunderstanding. This statement
> > "The Signature Element is enveloped by the <Contract1> element. This
> > particular association gives the XML Signature the enveloped property"
> > is correct. The Contract1 element envelopes the Signature element.
> >
> > The <Reference URI=*"#ImportantElement"> is a detached Signature..
> >
> > What we do not know, without more information, is whether the
<Reference
> > URI="http://www.remote-server.com/file.doc"> points to the document
that
> > contains the Contract1 element. If it does, that is an Enveloped
Signature.
> >
> > >
> > > >
> > > > My final question is, if a really want to sign the
<ImportantContent>
> > > > element using an enveloped signature. Do i really need to put the
> > > > signature as child of the <ImportantContent> element or not?? does
the
> > > > location of the signature have a significant impact?
> > >
> > > Yes, otherwise it is not an enveloped signature.
> > >
> > > > or when the
> > > > signature is enveloped it is allways located as the "last child" of
the
> >
> > > > document element inside an XML document..
> > >
> > > It doesn't have to be the last child, it could be the first, the
second,
> > > or any descendant element.
> > >
> > > --Sean
> >
>
>
> Express yourself instantly with MSN Messenger! MSN Messenger
RE: doubt with enveloped signature concept
Posted by Francisco Sepulveda <sh...@hotmail.com>.
Michael, if i understand right the http://www.remote-server.com/file.doc by definition (w3c) is a detached signature because it point to a "thing" located external to the signature itself
Francisco
> Subject: Re: doubt with enveloped signature concept> To: security-dev@xml.apache.org> CC: Sean.Mullan@Sun.COM; security-dev@xml.apache.org> From: mikemci@us.ibm.com> Date: Tue, 8 Jan 2008 14:48:52 -0500> > Sean.Mullan@Sun.COM wrote on 01/08/2008 02:30:00 PM:> > > Francisco Sepulveda wrote:> > > Hello, I'm having problems with respect to what i understand about the> > > concept of an "enveloped signature"> > >> > > The W3C define the signature as /"The signature is over the XML content> > > > that contains the signature as an element. The content provides the> root> > > XML document element. Obviously, enveloped signatures must take care> not> > > to include their own value in the calculation of the |SignatureValue|"/> > >> > > I have seen that the following xml document has a broad acceptation as> a> > > typical use of digital signature .... the classic enveloped signature> of> > > the whole document> > >> > > <document>> > > <element>> > > </element>> > > <signature>> > > <SignedInfo>> > > ...> > > <Reference URI="">> > > <Transforms>> > > <Transform> > > Algorithm=http://www.w3.org/2000/09/xmldsig#enveloped-signature/>> > > </Transforms>> > > <DigestMethod .../>> > > <DigestValue> .... </DigestValue>> > > </Reference>> > > </SignedInfo>> > > ...> > > </signature>> > > </document>> > >> > > In the above example, there is clear for me that the signature is child> > > > of the xml content being signed.> > >> > > But i read in a book from McGrawHill an it shows this example of a> > > signature that is enveloped, enveloping and detached...> > >> > > * *> > >> > > *<Contract1>*> > >> > > * <ImportantContent Id="ImportantElement">*> > >> > > * This is important content!*> > >> > > * </ImportantContent>*> > >> > > * *> > >> > > * <Signature Id="ThreeTypes">*> > >> > > * <SignedInfo>*> > >> > > * <Reference> > > URI=**"http://www.remote-server.com/file.doc">*> > >> > > * . . .*> > >> > > * </Reference>*> > >> > > * <Reference URI=**"#contract2">*> > >> > > * . . .*> > >> > > * </Reference>*> > >> > > * <Reference URI=**"#ImportantElement">*> > >> > > * . . .*> > >> > > * </Reference>*> > >> > > * </SignedInfo>*> > >> > > * <SignatureValue> . . . </SignatureValue>*> > >> > > * <Object Id="contract2">*> > >> > > * <Contract2> This is also very important> > > content! </Contract2>*> > >> > > * </Object>*> > >> > > * </Signature>*> > >> > > *</Contract1>*> > >> > > * *> > >> > > *FOR ME, the detached and enveloping signature are REALLY clear, but i> > > have doubt about the enveloped signature .... the book said*> > >> > > * *> > >> > > *"The Signature Element is enveloped by the <Contract1> element. This> > > particular association gives the XML Signature the enveloped property"*> > >> > > * *> > >> > > * *> > >> > >> > > So, that is my point, maybe i'm wrong but for me the <Reference> > > URI=*"#ImportantElement"> is a detached signature or not???*> >> > Based on the example above, you're right and the book is wrong. If in> > the example above, the ImportantElement ID was an attribute of the> > Content element then it would be enveloped. It might be nice to send the> > author a comment about that.> > I think there is a misunderstanding. This statement> "The Signature Element is enveloped by the <Contract1> element. This> particular association gives the XML Signature the enveloped property"> is correct. The Contract1 element envelopes the Signature element.> > The <Reference URI=*"#ImportantElement"> is a detached Signature..> > What we do not know, without more information, is whether the <Reference> URI="http://www.remote-server.com/file.doc"> points to the document that> contains the Contract1 element. If it does, that is an Enveloped Signature.> > >> > >> > > My final question is, if a really want to sign the <ImportantContent>> > > element using an enveloped signature. Do i really need to put the> > > signature as child of the <ImportantContent> element or not?? does the> > > location of the signature have a significant impact?> >> > Yes, otherwise it is not an enveloped signature.> >> > > or when the> > > signature is enveloped it is allways located as the "last child" of the> > > > document element inside an XML document..> >> > It doesn't have to be the last child, it could be the first, the second,> > or any descendant element.> >> > --Sean>
_________________________________________________________________
Express yourself instantly with MSN Messenger! Download today it's FREE!
http://messenger.msn.click-url.com/go/onm00200471ave/direct/01/
Re: doubt with enveloped signature concept
Posted by Sean Mullan <Se...@Sun.COM>.
Michael McIntosh wrote:
> I think there is a misunderstanding. This statement
> "The Signature Element is enveloped by the <Contract1> element. This
> particular association gives the XML Signature the enveloped property"
> is correct. The Contract1 element envelopes the Signature element.
While true, I wonder if the author really meant to use "enveloped" in
that general sense or if it is due to a bug in the example (my guess is
the latter). In any case, I would at least consider changing the text or
make it more clear what "enveloped" means in this context. I guess only
the author knows for sure what he meant :)
--Sean
Re: doubt with enveloped signature concept
Posted by Michael McIntosh <mi...@us.ibm.com>.
Sean.Mullan@Sun.COM wrote on 01/08/2008 02:30:00 PM:
> Francisco Sepulveda wrote:
> > Hello, I'm having problems with respect to what i understand about the
> > concept of an "enveloped signature"
> >
> > The W3C define the signature as /"The signature is over the XML content
> > that contains the signature as an element. The content provides the
root
> > XML document element. Obviously, enveloped signatures must take care
not
> > to include their own value in the calculation of the |SignatureValue|"/
> >
> > I have seen that the following xml document has a broad acceptation as
a
> > typical use of digital signature .... the classic enveloped signature
of
> > the whole document
> >
> > <document>
> > <element>
> > </element>
> > <signature>
> > <SignedInfo>
> > ...
> > <Reference URI="">
> > <Transforms>
> > <Transform
> > Algorithm=http://www.w3.org/2000/09/xmldsig#enveloped-signature/>
> > </Transforms>
> > <DigestMethod .../>
> > <DigestValue> .... </DigestValue>
> > </Reference>
> > </SignedInfo>
> > ...
> > </signature>
> > </document>
> >
> > In the above example, there is clear for me that the signature is child
> > of the xml content being signed.
> >
> > But i read in a book from McGrawHill an it shows this example of a
> > signature that is enveloped, enveloping and detached...
> >
> > * *
> >
> > *<Contract1>*
> >
> > * <ImportantContent Id="ImportantElement">*
> >
> > * This is important content!*
> >
> > * </ImportantContent>*
> >
> > * *
> >
> > * <Signature Id="ThreeTypes">*
> >
> > * <SignedInfo>*
> >
> > * <Reference
> > URI=**"http://www.remote-server.com/file.doc">*
> >
> > * . . .*
> >
> > * </Reference>*
> >
> > * <Reference URI=**"#contract2">*
> >
> > * . . .*
> >
> > * </Reference>*
> >
> > * <Reference URI=**"#ImportantElement">*
> >
> > * . . .*
> >
> > * </Reference>*
> >
> > * </SignedInfo>*
> >
> > * <SignatureValue> . . . </SignatureValue>*
> >
> > * <Object Id="contract2">*
> >
> > * <Contract2> This is also very important
> > content! </Contract2>*
> >
> > * </Object>*
> >
> > * </Signature>*
> >
> > *</Contract1>*
> >
> > * *
> >
> > *FOR ME, the detached and enveloping signature are REALLY clear, but i
> > have doubt about the enveloped signature .... the book said*
> >
> > * *
> >
> > *"The Signature Element is enveloped by the <Contract1> element. This
> > particular association gives the XML Signature the enveloped property"*
> >
> > * *
> >
> > * *
> >
> >
> > So, that is my point, maybe i'm wrong but for me the <Reference
> > URI=*"#ImportantElement"> is a detached signature or not???*
>
> Based on the example above, you're right and the book is wrong. If in
> the example above, the ImportantElement ID was an attribute of the
> Content element then it would be enveloped. It might be nice to send the
> author a comment about that.
I think there is a misunderstanding. This statement
"The Signature Element is enveloped by the <Contract1> element. This
particular association gives the XML Signature the enveloped property"
is correct. The Contract1 element envelopes the Signature element.
The <Reference URI=*"#ImportantElement"> is a detached Signature..
What we do not know, without more information, is whether the <Reference
URI="http://www.remote-server.com/file.doc"> points to the document that
contains the Contract1 element. If it does, that is an Enveloped Signature.
>
> >
> > My final question is, if a really want to sign the <ImportantContent>
> > element using an enveloped signature. Do i really need to put the
> > signature as child of the <ImportantContent> element or not?? does the
> > location of the signature have a significant impact?
>
> Yes, otherwise it is not an enveloped signature.
>
> > or when the
> > signature is enveloped it is allways located as the "last child" of the
> > document element inside an XML document..
>
> It doesn't have to be the last child, it could be the first, the second,
> or any descendant element.
>
> --Sean
Re: doubt with enveloped signature concept
Posted by Sean Mullan <Se...@Sun.COM>.
Francisco Sepulveda wrote:
> Hello, I'm having problems with respect to what i understand about the
> concept of an "enveloped signature"
>
> The W3C define the signature as /"The signature is over the XML content
> that contains the signature as an element. The content provides the root
> XML document element. Obviously, enveloped signatures must take care not
> to include their own value in the calculation of the |SignatureValue|"/
>
> I have seen that the following xml document has a broad acceptation as a
> typical use of digital signature .... the classic enveloped signature of
> the whole document
>
> <document>
> <element>
> </element>
> <signature>
> <SignedInfo>
> ...
> <Reference URI="">
> <Transforms>
> <Transform
> Algorithm=http://www.w3.org/2000/09/xmldsig#enveloped-signature/>
> </Transforms>
> <DigestMethod .../>
> <DigestValue> .... </DigestValue>
> </Reference>
> </SignedInfo>
> ...
> </signature>
> </document>
>
> In the above example, there is clear for me that the signature is child
> of the xml content being signed.
>
> But i read in a book from McGrawHill an it shows this example of a
> signature that is enveloped, enveloping and detached...
>
> * *
>
> *<Contract1>*
>
> * <ImportantContent Id="ImportantElement">*
>
> * This is important content!*
>
> * </ImportantContent>*
>
> * *
>
> * <Signature Id="ThreeTypes">*
>
> * <SignedInfo>*
>
> * <Reference
> URI=**"http://www.remote-server.com/file.doc">*
>
> * . . .*
>
> * </Reference>*
>
> * <Reference URI=**"#contract2">*
>
> * . . .*
>
> * </Reference>*
>
> * <Reference URI=**"#ImportantElement">*
>
> * . . .*
>
> * </Reference>*
>
> * </SignedInfo>*
>
> * <SignatureValue> . . . </SignatureValue>*
>
> * <Object Id="contract2">*
>
> * <Contract2> This is also very important
> content! </Contract2>*
>
> * </Object>*
>
> * </Signature>*
>
> *</Contract1>*
>
> * *
>
> *FOR ME, the detached and enveloping signature are REALLY clear, but i
> have doubt about the enveloped signature .... the book said*
>
> * *
>
> *"The Signature Element is enveloped by the <Contract1> element. This
> particular association gives the XML Signature the enveloped property"*
>
> * *
>
> * *
>
>
> So, that is my point, maybe i'm wrong but for me the <Reference
> URI=*"#ImportantElement"> is a detached signature or not???*
Based on the example above, you're right and the book is wrong. If in
the example above, the ImportantElement ID was an attribute of the
Content element then it would be enveloped. It might be nice to send the
author a comment about that.
>
> My final question is, if a really want to sign the <ImportantContent>
> element using an enveloped signature. Do i really need to put the
> signature as child of the <ImportantContent> element or not?? does the
> location of the signature have a significant impact?
Yes, otherwise it is not an enveloped signature.
> or when the
> signature is enveloped it is allways located as the "last child" of the
> document element inside an XML document..
It doesn't have to be the last child, it could be the first, the second,
or any descendant element.
--Sean