【发布时间】:2017-04-12 00:33:31
【问题描述】:
我在突出显示的行中遇到访问冲突异常。
试图读取或写入受保护的内存。这通常表明其他内存已损坏。
我在 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 的新手。
感谢您在这方面的任何帮助。
我还尝试通过传递 32 位 crypto.dll 将应用程序构建为 32 位,但在这种情况下,我在 PKCS11Interop Net.Pkcs11Interop.LowLevelAPI81.Delegates.InitializeWithGetFunctionList(IntPtr libraryHandle) 的这一行中遇到异常,异常是
对于 UInt32,值太大或太小。溢出异常未处理。
【问题讨论】:
-
我从这一行得到异常 (session.FindObjectsInit(); )。我是 pkcs11 的新手。感谢您在这方面的任何帮助。我还尝试通过传递 32 位加密 dll 将应用程序构建为 32 位,但在这种情况下,我从 PKCS11Interop Net.Pkcs11Interop.LowLevelAPI81.Delegates.InitializeWithGetFunctionList(IntPtr libraryHandle) 中的这一行得到异常,异常是 {"Value对于 UInt32 来说太大或太小。"} OverflowExcepiton 未处理。
标签: pkcs#11 pkcs11interop