SignAttached
security and signatures
Description
Produces a DER-encoded attached CMS signature whose content is embedded in the signature itself, so one blob carries both the data and the signature. The method signs with the open software identity and the selected digest; the CAdES profile and custom signed attributes of SignDetachedEx are not offered here.
Syntax
Delphi
function TPDFNativeSigningIdentity.SignAttached(const Data: AnsiString; DigestAlgorithm: Integer;
out Signature: AnsiString; out ErrorText: WideString): Boolean;Parameters
| Data | Bytes to sign and embed; input above 256 MiB is rejected |
|---|---|
| DigestAlgorithm | Digest 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 |
| Signature | Receives the DER-encoded attached CMS; cleared when the call fails |
| ErrorText | Receives an English diagnostic when the call fails |
Return values
| True | Signature holds the complete DER-encoded CMS with embedded content |
|---|---|
| False | No software identity is open, the data exceeds the byte limit, or the digest selector is unsupported; ErrorText describes the failure |
Remarks
RSA-PSS padding requires the detached profile, so a PSS key or an enabled RSAPSSPadding flag fails on this method.
The class is functional on non-Windows Free Pascal targets; on Windows targets the call reports native signing as unavailable.