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(

Ready to get started?

Learn more about SecureBlackbox or download a free trial.

Download Now