PDFSM4DecryptStringBuffer

Cryptography

Description

Decrypts an IV-prefixed SM4-CBC blob supplied as a raw pointer and byte count

Syntax

Delphi

Function PDFSM4DecryptStringBuffer(Const Key: AnsiString;
  Ciphertext: Pointer; CiphertextLength: Integer): AnsiString;

Parameters

KeyExactly 16 bytes
CiphertextPointer to the IV-prefixed blob; must not be nil
CiphertextLengthAt least 32 and a multiple of 16

Return values

The unpadded plaintext, or an empty string when the buffer is malformed or the padding check fails

Remarks

Equivalent to PDFSM4DecryptString after copying CiphertextLength bytes from the buffer

Use this form for memory-mapped or socket buffers to avoid an intermediate string copy

See also

PDFSM4DecryptString, PDFSM4EncryptString, SM4DecryptCBCPKCS7