/// <summary>
/// Initializes a new instance of the CkAesCbcEncryptDataParams class.
/// </summary>
/// <param name='aesKeyBits'>Length of the temporary AES key in bits</param>
/// <param name='oaepParams'>Parameters of the temporary AES key wrapping</param>
public CkRsaAesKeyWrapParams(NativeULong aesKeyBits, CkRsaPkcsOaepParams oaepParams)
{
_lowLevelStruct.AESKeyBits = 0;
_lowLevelStruct.OAEPParams = IntPtr.Zero;
if (oaepParams == null)
{
throw new ArgumentNullException("oaepParams");
}
// Keep the reference to OAEP params so GC will not free it while this object exists
_oaepParams = oaepParams;
_lowLevelStruct.AESKeyBits = aesKeyBits;
_lowLevelStruct.OAEPParams = UnmanagedMemory.Allocate(UnmanagedMemory.SizeOf(typeof(CK_RSA_PKCS_OAEP_PARAMS)));
UnmanagedMemory.Write(_lowLevelStruct.OAEPParams, oaepParams.ToMarshalableStructure());
}