EldoS | Feel safer!

Software components for data protection, secure storage and transfer

How to fill SigPolicyHash for XAdES

The digest value of the signature policy is calculated over SigPolicyId \Identifier element. If Identifier element contains an URI, then the hash is calculated on the downloaded file (for example using TElHashFunction class), in most cases you can cache the digest value.

Example of how to calculate a digest value (Delphi code):

var Data: ByteArray; // contains a data of the downloaded file
XAdESSigner.PolicyId.SigPolicyHash.DigestMethod := SBXMLSec.DigestMethodToURI(xdmSHA1);
XAdESSigner.PolicyId.SigPolicyHash.DigestValue := SBXMLSec.CalculateDigest(@Data[0], Length(Data), xdmSHA1); // or use TElHashFunction class to calculate a hash

Example of how to fill DigestValue with a cached value (C# code):

XAdESSigner.PolicyId.SigPolicyHash.DigestMethod = SBXMLSec.Unit.DigestMethodToURI(SBXMLSec.Unit.xdmSHA1);
XAdESSigner.PolicyId.SigPolicyHash.DigestValue = SBUtils.Unit.BytesOfString(SBEncoding.Unit.Base64DecodeString("zURNiVLyZRVTImCjiv/NKLQiq4M=="));

Return to the list

|

Back to top

As of July 15, 2016 EldoS Corporation will operate as a division of /n software inc. For more information, please read the announcement.

Got it!