I am using Soap

<ds:SignedInfo>
<ds:CanonicalizationMethod Algorithm="http://www.w3.org/2001/10/xml-exc-c14n#"/>
<ds:SignatureMethod Algorithm="http://www.w3.org/2000/09/xmldsig#rsa-sha1"/>
<ds:Reference URI="#id-4453123">
<ds:Transforms>
<ds:Transform Algorithm="http://www.w3.org/2001/10/xml-exc-c14n#"/>
</ds:Transforms>
<ds:DigestMethod Algorithm="http://www.w3.org/2000/09/xmldsig#sha1"/>
<ds:DigestValue>'.$ssDigest.'</ds:DigestValue>
</ds:Reference>
</ds:SignedInfo>
<ds:SignatureValue>...How to calculate Signature Value.....</ds:SignatureValue>

..............

Thanks in advance

Recommended Answers

All 4 Replies

This should be described in the documentation of the soap service you're using.

If it is sha1 and you're using php, then sha1('something here') should do it.

Thanks a lot Brother.

But i have already use sha1.....but facing error.
[faultstring] => Hash values do not match. (from client)

i have also referance site like :
http://www.cryptosys.net/pki/xmldsig-ChileSII.html#creatingxmldsig

But i cann't generate my Signature Value and facing error......Hash Values do not match..plz help me

You should have a look at the demos on that page. sha1() is not enough, you need to canonicalize the data as described.

you are right brother........

$dom = new DOMDocument();
$dom->loadXML($myXMLData);
$canonicalized = $dom->C14N(); // for the whole document

$ssDigest = base64_encode(pack("H*", sha1($canonicalized)));

from above code we easily get a DigestValue...and i have read in somewhere....encrypt of Digestvalue is SignatureValue.

i try manytimes but not get a solution....

how to get SignatureValue from DigestValue ??

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.