0

我有一个 gtop11dotnet.dll。它是来自 Gemalto 网站的适用于 Windows v2.2.0.9 的 .NET PKCS#11 库。DLL 包含 C_GetCardProperty 方法,可用于检索智能卡的序列号或 GUID。根据 PKCS#11 User's Guide 和 .NET Integration Guide,它是“byte[] GetCardProperty(byte property, byte flags)”。它接收两个字节作为参数并以字节数组的形式检索例如序列号或 GUID。我的问题是如何获取序列号并将其存储到托管字节数组中?

这是我的尝试:

[DllImport("gtop11dotnet.dll")]
public static extern byte[] C_GetCardProperty(byte property, byte flags);
public static void Main()
{
    byte[] bytes = new byte[12];
    bytes = C_GetCardProperty(0x06, 0x00) //Error at this line -> Cannot marshal 'return value': Invalid managed/unmanaged type combination.
}

谢谢你的帮助。

4

2 回答 2

0

What is ".NET PKCS#11"? PKCS#11 v2.20 nor v2.30 draft do not contain "C_GetCardProperty" method. You are probably facing with some proprietary Gemalto/.NET thing that has nothing to do with PCKS#11 as known by the rest of the world and Gemalto does a "good" thing by prefixing arbitrary functions with "C_" and calling the result cryptoki. PKCS#11 is a C interface and has nothing to do with managed/unmanaged code or .NET.

于 2011-06-30T18:21:36.793 回答
0

尝试这个。

public static extern uint C_GetCardProperty(uint slotID, byte property, byte flags, byte[] blob, ref byte length);

于 2013-02-28T11:10:44.453 回答