SignDetached
Security and signatures
Description
Produces a DER-encoded detached CMS signature over Data with the open identity. With CAdES set, the signature follows the CAdES profile used for PAdES: the signing-time attribute is left out and the authenticated attributes are signed separately. The call is the plain form of SignDetachedEx and supplies no custom attribute values.
RSA keys sign with PKCS #1 v1.5 padding unless RSAPSSPadding is set or the key itself is an RSA-PSS key, in which case PSS parameters are configured on the signer; PSS is offered only for the detached profile. SHA-3 digests combined with RSA-PSS are produced through a dedicated signing path.
Syntax
Delphi
function TPDFNativeSigningIdentity.SignDetached(const Data: AnsiString; DigestAlgorithm: Integer; CAdES: Boolean;
out Signature: AnsiString; out ErrorText: WideString): Boolean;Parameters
| Data | Bytes to sign; 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 |
| CAdES | Selects the CAdES profile without the signing-time attribute |
| Signature | Receives the DER-encoded detached 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 |
|---|---|
| False | No software identity is open, the data exceeds the byte limit, or the digest selector is unsupported; ErrorText describes the failure |
Remarks
The method requires an identity opened with OpenPKCS12; a token identity from OpenPKCS11 signs OCSP requests only.
The class is functional on non-Windows Free Pascal targets with an OpenSSL 3 library loaded at runtime; on Windows targets the call reports native signing as unavailable.
See also
NativeCMSSignedAttributes, SetSignProcessRSAPSSPadding, GetNativeBackendCapabilities