padPKCS7

PKCS#7 padding.

Pads the given byte buffer to the given length. The value of the padding byte is the same as the number of bytes added to the buffer, example:

A 3-byte buffer with the contents [0xAB, 0xCD, 0xEF] is padded to length 8. The buffer will now contain [0xAB, 0xCD, 0xEF, 0x05, 0x05, 0x05, 0x05, 0x05]

PKCS#7 padding is only defined for cases where the number of bytes to be padded is less than 256.

ubyte[]
padPKCS7
(
ref ubyte[] buffer
,
size_t pad_len
)

Parameters

buffer ubyte[]

A reference to the buffer to pad

pad_len size_t

The length to pad the buffer to

Return Value

Type: ubyte[]

The padded buffer

Meta