SetSignProcessSM2Identity
Security and signatures
Description
Attaches an SM2 certificate and private scalar to a signature process so it signs with GB/T 32918 paired with the SM3 digest
Syntax
Delphi
Function SetSignProcessSM2Identity(SignProcessID: Integer; Const CertificateDER, PrivateKeyDER: AnsiString): Integer;ActiveX
Function PDFlib::SetSignProcessSM2Identity(SignProcessID As Long, CertificateDER As Variant, PrivateKeyDER As Variant) As LongDLL
int DLSetSignProcessSM2Identity(int InstanceID, int SignProcessID, const char* CertificateDER, int CertificateLength, const char* PrivateKeyDER, int PrivateKeyLength);Parameters
| SignProcessID | Signature process handle returned by NewSignProcessFrom* |
|---|---|
| CertificateDER | DER certificate whose SubjectPublicKeyInfo carries either id-ecPublicKey with the SM2 curve parameter 1.2.156.10197.1.301 (the GM/T 0015 layout) or the SM2 algorithm identifier 1.2.156.10197.1.301 itself, and an uncompressed 65-byte public point |
| PrivateKeyDER | Raw 32-byte private scalar, or an unencrypted PKCS #8 / SEC1 DER structure wrapping one |
Return values
1 when the identity was accepted, or 0 for an unknown process or an identity whose derived public point does not match the certificate
Remarks
The identity replaces every other attached identity: certificate-store, CNG, external-digest, Ed25519, Ed448 and ML-DSA bindings are cleared
Signing pairs with the SM3 digest (GB/T 32905); digest code 8 is accepted by SetSignProcessDigestAlgorithm and any other selection is normalized to SM3 automatically
The detached CMS SignerInfo carries the SM2-with-SM3 algorithm identifier 1.2.156.10197.1.501, the SM3 digest identifier 1.2.156.10197.1.401 and the (r, s) pair as a DER SEQUENCE of two INTEGERs
ZA is derived with the GB/T 32918.2 default distinguishing identifier 1234567812345678; the signature nonce comes from the library CSPRNG
The adbe.pkcs7.detached and ETSI.CAdES.detached SubFilters are supported; legacy pre-hashed SubFilters are not
See also
SetSignProcessDigestAlgorithm, SetSignProcessSM2IdentityFromFile, SetSignProcessEd448Identity, SetSignProcessMLDSAIdentity