Я пытаюсь использовать следующий код:
// Specify mechanism parameters
// Note that we are allocating unmanaged memory that will have to be freed later
CK_DES_CBC_ENCRYPT_DATA_PARAMS mechanismParams = new CK_DES_CBC_ENCRYPT_DATA_PARAMS();
mechanismParams.Data = UnmanagedMemory.Allocate(data.Length);
UnmanagedMemory.Write(mechanismParams.Data, data);
mechanismParams.Length = ConvertUtils.UInt32FromInt32(data.Length);
mechanismParams.Iv = ConvertUtils.HexStringToBytes("0000000000000000");
// Specify derivation mechanism with parameters
// Note that CkmUtils.CreateMechanism() automaticaly copies mechanismParams into newly allocated unmanaged memory
CK_MECHANISM mechanism = CkmUtils.CreateMechanism(CKM.CKM_DES3_CBC_ENCRYPT_DATA, mechanismParams);
// Derive key
NativeULong derivedKey_ID = CK.CK_INVALID_HANDLE;
rv = pkcs11Library.C_DeriveKey(session, ref mechanism, KEY_ID_BASE, null, 0, ref derivedKey_ID);
if (rv != CKR.CKR_OK)
Console.WriteLine("Derive Key Fail >> " + rv.ToString());
Is выдает мне ошибку Ошибка ключа получения >> CKR_MECHANISM_INVALID
Любая идея, что не так в механизм?