PDFSM4EncryptToStream
Cryptography
Description
Encrypts a string exactly like PDFSM4EncryptString and writes the IV-prefixed ciphertext to a stream
Syntax
Delphi
Function PDFSM4EncryptToStream(Const Key, Plaintext: AnsiString;
Target: TStream): Int64;Parameters
| Key | Exactly 16 bytes |
|---|---|
| Plaintext | Any length; padded with PKCS#7 before encryption |
| Target | Assigned stream receiving the IV-prefixed ciphertext |
Return values
| count | The number of bytes written, matching PDFSM4EncryptedLength(Length(Plaintext)) |
|---|---|
| -1 | Target is unassigned or the encryption failed |
Remarks
The stream is written with WriteBuffer, so an existing position is respected and stream errors raise
See also
PDFSM4EncryptString, PDFSM4DecryptStringBuffer, PDFSM4EncryptedLength