我在突出显示的行中收到访问冲突异常。
尝试读取或写入受保护的内存。这通常表明其他内存已损坏。
我在hsm
和上都有证书label
。我正在将我的应用程序构建为 x64
public void getCertificateFromHSM(string certLabel) {
List<ObjectAttribute> objectAttributes = new List<ObjectAttribute>();
objectAttributes.Add(new ObjectAttribute(CKA.CKA_CLASS, CKO.CKO_CERTIFICATE));
objectAttributes.Add(new ObjectAttribute(CKA.CKA_LABEL, certLabel));
**session.FindObjectsInit(objectAttributes);** --Exception from here
// Get search results
List<ObjectHandle> foundObjects = session.FindObjects(2);
// Terminate searching
session.FindObjectsFinal();
// Prepare list of empty attributes we want to read
List<CKA> attributes = new List<CKA>();
attributes.Add(CKA.CKA_LABEL);
attributes.Add(CKA.CKA_VALUE);
}
我从这条线上得到了例外session.FindObjectsInit();
。我是新手pkcs11
。
感谢您在这方面的任何帮助。
我还尝试通过传递 32bit 将应用程序构建为 32 位crypto.dll
,但在这种情况下,我从这一行得到异常,PKCS11Interop Net.Pkcs11Interop.LowLevelAPI81.Delegates.InitializeWithGetFunctionList(IntPtr libraryHandle)
异常是
对于 UInt32,值太大或太小。溢出异常未处理。