SignDetachedEx

Security and signatures

Description

Produces a DER-encoded detached CMS signature and injects up to three caller-supplied signed attribute values: a CAdES commitment-type-indication, a CAdES signature policy identifier, and an Adobe archival revocation value. Each nonempty value must be one complete bounded DER sequence without the outer attribute OID or SET wrapper; an empty value omits the corresponding attribute, and values from an earlier call do not carry over.

The values must fit the selected CMS profile: custom values require the detached form, a CAdES signature accepts commitment and policy values and rejects a revocation value, and a non-CAdES signature accepts only the archival revocation value. Combined custom input is limited to 16 MiB before decoding, and the complete encoded CMS output is limited to 16 MiB as well.

Syntax

Delphi

function TPDFNativeSigningIdentity.SignDetachedEx(const Data: AnsiString; DigestAlgorithm: Integer; CAdES: Boolean;
  const CommitmentTypeDER, SignaturePolicyDER, RevocationInfoDER: AnsiString;
  out Signature: AnsiString; out ErrorText: WideString): Boolean;

Parameters

DataBytes to sign; input above 256 MiB is rejected
DigestAlgorithmDigest selector: 0 and 2 select SHA-256, 1 SHA-1, 3 SHA-384, 4 SHA-512, 5 SHA3-256, 6 SHA3-384, 7 SHA3-512
CAdESSelects the CAdES profile, which admits commitment and policy values and excludes the signing-time attribute
CommitmentTypeDERComplete DER sequence for the commitment-type-indication attribute, or empty to omit it
SignaturePolicyDERComplete DER sequence for the signature-policy identifier attribute, or empty to omit it
RevocationInfoDERComplete DER sequence for the Adobe archival revocation attribute, or empty to omit it
SignatureReceives the DER-encoded detached CMS; cleared when the call fails
ErrorTextReceives an English diagnostic when the call fails

Return values

TrueSignature holds the complete DER-encoded CMS with the accepted attributes
FalseNo software identity is open, a value is malformed or exceeds a bound, or the values do not fit the selected profile; ErrorText describes the failure

Remarks

Attribute validation checks complete sequence envelopes, nested TLV bounds, minimal length encoding, a maximum depth of 64 and a maximum of 1000000 elements per value, but leaves the meaning of the pre-encoded values to the caller.

The method requires an identity opened with OpenPKCS12 and is available on non-Windows Free Pascal targets.

See also

NativeCMSSignedAttributes, SetSignProcessCommitmentType, SetSignProcessSignaturePolicy, AddSignProcessRevocationCRL, AddSignProcessRevocationOCSP