PDFium Delphi Component Docs

FPdfHmac unit

Unit: FPdfHmac
Dependency-free HMAC-SHA256 and HKDF-SHA256 primitives used by PDF MAC key derivation and authentication

Syntax

function HmacSha256(const Key, Data: TBytes): TSHA256Digest;
function HkdfSha256(const InputKeyMaterial, Salt, Info: TBytes;
  OutputLength: Integer): TBytes;
function ConstantTimeBytesEqual(const Left, Right: TBytes): Boolean;
procedure SecureClearBytes(var Data: TBytes);

Description

HmacSha256 implements RFC 2104 authentication over arbitrary byte arrays and hashes keys longer than the SHA-256 block size before constructing the inner and outer pads

HkdfSha256 implements RFC 5869 extract-and-expand derivation with output lengths from zero through 8160 bytes

ConstantTimeBytesEqual compares both content and length without returning at the first mismatch whilst SecureClearBytes clears managed byte storage before releasing it

See Also

FPdfSha256, FPdfMac, FPdfEncrypt