CryptoSys PKI Toolkit Manual

RSA_KemUnwrap

RSA_KemUnwrap Unwraps (decrypts) secret key material using RSA-KEM ("Simple RSA") with the recipient's RSA private key.

VB6/VBA Syntax

Public Declare Function RSA_KemUnwrap Lib "diCrPKI.dll" (ByRef abOutput As Byte, ByVal nOutBytes As Long, ByRef abData As Byte, ByVal nDataLen As Long, ByVal strPrivateKey As String, ByVal nOptions As Long) As Long

nRet = RSA_KemUnwrap(abOutput(0), nOutBytes, abData(0), nDataLen, strPrivateKey, nOptions)

Parameters

abOutput
[out] Byte array to receive the encrypted output.
nOutBytes
[in] Long specifying the maximum length of the output array in bytes.
abData
[in] Byte array containing the key material data to be wrapped.
nDataLen
[in] Long specifying the number of bytes in the data.
strPrivateKey
[in] String containing the recipient's private key in "internal" format.
nOptions
[in] Long option flags. Select one block cipher algorithm for the data encapsulation mechanism from
PKI_BC_AES128 to use aes128-Wrap (default)
PKI_BC_AES192 to use aes192-Wrap
PKI_BC_AES256 to use aes256-Wrap
PKI_BC_3DES to use cms3DESWrap
and select one KDF2-HashFunction from
PKI_HASH_SHA1 to use sha1 (default)
PKI_HASH_SHA224 to use sha224
PKI_HASH_SHA256 to use sha256
PKI_HASH_SHA384 to use sha384
PKI_HASH_SHA512 to use sha512

C/C++ Syntax

long _stdcall RSA_KemUnwrap(unsigned char *lpOutput, long nOutBytes, const unsigned char *lpData, long nDataLen, const char *szPrivateKey, long nOptions);

Returns (VB6/C)

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

.NET Equivalent

Rsa.KemUnwrap Method

[C#]
public static byte[] KemUnwrap( byte[] data, string privateKey, WrapAlgorithm wrap, KdfFunc kdf, HashAlgorithm kdfHashFunc );
[VB.NET]
Public Shared Function KemUnwrap( ByVal message As Byte(), ByVal privateKey As String, ByVal wrap As WrapAlgorithm, ByVal kdf As KdfFunc, ByVal kdfHashFunc As HashAlgorithm ) As Byte()

.NET Return Value

Unwrapped key material.

Refer to the .NET Help File for more details of the .NET equivalent methods.

Remarks

This function unwraps, i.e. decrypts, key material wrapped by the RSA_KemWrap function. The user must specify the same parameters used to wrap the key material. No parity bit checks or changes are made for a Triple-DES key.

Example

See RSA_KemWrap.

See Also

RSA_KemWrap CIPHER_KeyWrap CIPHER_KeyUnwrap

[Contents] [Index]

[HOME]   [NEXT: TDEA_B64Mode...]

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