SM4DecryptECBPKCS7

Cryptography

Description

Decrypts PKCS#7-padded SM4 ECB ciphertext under a 16-byte key and strips the padding

Syntax

Delphi

Function SM4DecryptECBPKCS7(Const Key, Ciphertext: AnsiString): AnsiString;

Parameters

KeyExactly 16 bytes
CiphertextLength must be a multiple of 16

Return values

The unpadded plaintext, or an empty string when the input is invalid or the padding check fails

Remarks

Part of the pure-Pascal SM4 block cipher (GB/T 32907-2016)

A failed padding check or a wrong key yields an empty result, mirroring the behaviour of SM4TryUnpadPKCS7

Counterpart of SM4EncryptECBPKCS7

See also

SM4EncryptECBPKCS7, SM4DecryptECB, SM4DecryptCBCPKCS7, SM4UnpadPKCS7