You need to sign in to do that
Don't have an account?
How to calculate ds:DigestValue and ds:SignatureValue in apex
We are doing Integration with external systems and unable to calcualte ds:DigestValue and ds:SignatureValue values
Please let me know how to get ds:DigestValue, ds:SignatureValue values and in which order we have to calculate.
<soap:Envelope xmlns:soap="http://www.w3.org/2003/05/soap-envelope" xmlns:v1=".........." xmlns:v11="........"> <soap:Header xmlns:wsa="http://www.w3.org/2005/08/addressing"> <wsse:Security xmlns:wsse="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd" xmlns:wsu="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd"> <wsu:Timestamp wsu:Id="TS-128F375C5B3256FAE8151780686184254"> <wsu:Created>2018-02-05T15:07:42Z</wsu:Created> <wsu:Expires>2018-02-05T15:12:42Z</wsu:Expires> </wsu:Timestamp> <wsse:BinarySecurityToken EncodingType="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-soap-message-security-1.0#Base64Binary" ValueType="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-x509-token-profile-1.0#X509v3" wsu:Id="X509-128F375C5B3256FAE8151780686183551"> ---- --Certificate-</wsse:BinarySecurityToken> <ds:Signature Id="SIG-128F375C5B3256FAE8151780686183653" xmlns:ds="http://www.w3.org/2000/09/xmldsig#"> <ds:SignedInfo> <ds:CanonicalizationMethod Algorithm="http://www.w3.org/2001/10/xml-exc-c14n#"> <ec:InclusiveNamespaces PrefixList="wsa soap v1 v11" xmlns:ec="http://www.w3.org/2001/10/xml-exc-c14n#"/> </ds:CanonicalizationMethod> <ds:SignatureMethod Algorithm="http://www.w3.org/2000/09/xmldsig#rsa-sha1"/> <ds:Reference URI="#id-128F375C5B3256FAE8151780686183652"> <ds:Transforms> <ds:Transform Algorithm="http://www.w3.org/2001/10/xml-exc-c14n#"> <ec:InclusiveNamespaces PrefixList="soap v1 v11" xmlns:ec="http://www.w3.org/2001/10/xml-exc-c14n#"/> </ds:Transform> </ds:Transforms> <ds:DigestMethod Algorithm="http://www.w3.org/2000/09/xmldsig#sha1"/> <ds:DigestValue>--How to calcualte this?--</ds:DigestValue> </ds:Reference> </ds:SignedInfo> <ds:SignatureValue> --How to calcualte this?--</ds:SignatureValue> <ds:KeyInfo Id="KI-128F375C5B3256FAE8151780686183550"> <wsse:SecurityTokenReference wsu:Id="STR-128F375C5B3256FAE8151780686183551"> <wsse:Reference URI="#X509-128F375C5B3256FAE8151780686183549" ValueType="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-x509-token-profile-1.0#X509v3"/> </wsse:SecurityTokenReference> </ds:KeyInfo> </ds:Signature> </wsse:Security> </soap:Header>
Please let me know how to get ds:DigestValue, ds:SignatureValue values and in which order we have to calculate.
May I suggest you please give a try by using System.Crypto methods for all the Signing. which should help.
Please let us know if this helps.
Thanks,
Nagendra
I have the same usecase of need to generate the Digest and Signature value. Can you please let me know if you got succeeded? I tried using crypto.generatedigest and crypto.Sign methods but the values generated are not matching with other external tools values.
Salesforce not supports wsu tags, I suggested client to move to REST service