typedef struct CK_DES_CBC_ENCRYPT_DATA_PARAMS { CK_BYTE iv8; CK_BYTE_PTR pData; CK_ULONG length; } CK_DES_CBC_ENCRYPT_DATA_PARAMS;
StructLayout(LayoutKind.Sequential) public struct CK_DES_CBC_ENCRYPT_DATA_PARAMS { MarshalAs(UnmanagedType.ByValArray, SizeConst=8) public byte[] iv; MarshalAs(UnmanagedType.ByValArray, SizeConst=8) public byte[] data; public int length; }
CK_DES_CBC_ENCRYPT_DATA_PARAMS param = new CK_DES_CBC_ENCRYPT_DATA_PARAMS(); param.iv = new byte[]{0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10}; param.data = new byte[]{0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20}; param.length = 8;
Mechanism mechanism = new Mechanism(CKM_DES_CBC_ENCRYPT_DATA, param);