CryptoSys PKI Toolkit Manual

PAD_UnpadBytes

Removes the padding from an encryption block.

VB6/VBA Syntax

Public Declare Function PAD_UnpadBytes Lib "diCrPKI.dll" (ByRef abOutput As Byte, ByVal nOutputLen As Long, ByRef abInput As Byte, ByVal nInputLen As Long, ByVal nBlockLen As Long, ByVal nOptions As Long) As Long

nRet = PAD_UnpadBytes(abOutput(0), nOutputLen, abInput(0), nInputLen, nBlockLen, 0)

Parameters

abOutput
[out] Byte array to be filled with the output.
nOutputLen
[in] Long specifying the size of the output array in bytes.
abInput
[in] Byte array containing the padded data.
nInputLen
[in] Long specifying the length of the input in bytes.
nBlockLen
[in] Long specifying the cipher block length in bytes (8 or 16).
nOptions
[in] Long option flags: not used in this release. Specify zero.

C/C++ Syntax

long _stdcall PAD_UnpadBytes(unsigned char *output, long outlen, const unsigned char *input, long inlen, long blklen, long options);

Returns (VB6/C)

Long: If successful, the return value is the number of bytes in the output; otherwise it returns a negative error code.

.NET Equivalent

Use the method associated with the relevant encryption algorithm class:

Cipher.Unpad Method (Byte[], CipherAlgorithm)

Remarks

The padding is expected according to the convention in PKCS#5, PKCS#7 and CMS. If abOutput is set to vbNull or nOutputLen set to zero, then the required number of bytes will be returned. The output is always shorter than the input. Only block lengths of 8 or 16 bytes are supported. VB6 users should note the '(0)' in abOutput(0) and abInput(0).

Example

See the example in PAD_BytesBlock.

See Also

PAD_BytesBlock PAD_HexBlock PAD_UnpadHex

[Contents] [Index]

[HOME]   [NEXT: PAD_UnpadHex...]

Copyright © 2004-12 D.I. Management Services Pty Ltd. All rights reserved.