I am reading about XML signature from w3 page
As per my understanding, to Sign an XML:
- Create a Canonical XML of the XML Data to be signed.
- Create a hash (digest) of the Canonicalised XML Data using an algorithm mentioned in
<DigestMethod/>
. Hash will go inside<DigestValue>
- Encrypt above has using algorithm mentioned in
<SignatureMethod/>
. This algorithm will take Sender's private key as an input. Signature will go inside<SignatureValue>
To Verify (at receiver's end):
- Use the public key of the sender on the content of
<SignatureValue>
to get the hash. - Calculate the hash of data (xPath/referece to data can be found in
<Reference>
) using algorithm<DigestMethod>
- Check if this has matches with hash in
<DigestValue>
My Questions:
- Is my understanding correct?
- What is the role of
<KeyInfo>
in verifying signature given that sender's public key is sufficient for verifying?