Contents · Forum Home · StreamSec Tools 4.1.5.363 documentation

BuildATSHashIndexV3

function BuildATSHashIndexV3(const aCms: OctetString; aSignerIndex: Integer; aHashAlg: tHashAlgorithm; out aIndexDer: OctetString; out aError: string): Boolean;
BuildATSHashIndexV3 returns the ATSHashIndexV3 SEQUENCE (the bare 30 ... TLV, not the enclosing Attribute) over aCms' root SignedData.

Three rules that are each a silent-failure trap if broken:
- hashIndAlgorithm is ALWAYS encoded, even for SHA-256. The DEFAULT belonged to the deprecated v1 attribute and was removed in v3 because it made decoding ambiguous.
- entries are in STRUCTURE ORDER and never sorted; an empty index is 30 00, never an omitted field.
- unsignedAttrValuesHashIndex has ONE ENTRY PER AttributeValue, not per Attribute, each hashing DER(attrType) || DER(thatOneValue) - without the Attribute's own SEQUENCE header and without the attrValues SET header.