我们必须使用 Gemalto IDPrime .Net 卡 Smartcard。我们得到了这些 USB 加密狗,但必须更改 PIN。
Gemalto 通过 windows 说:
From the Start menu, choose Run and type PINTool. Insert a IDPrime .Net card in the reader as prompted, and click OK. The change PIN interface appears Enter the old PIN (the default PIN value is 0000), the new PIN and confirm the new PIN. Click on Change Pin
http://support.gemalto.com/index.php?id=how_to_change_pin_in_a_idprime#.VWYTWUa8rV8
这可行,但我想通过 powershell 或 c# 设置一个新的 PIN/密码,我。 e.在一个程序的控制下。 怎么做或不可能?
最佳答案
您应该能够通过非托管 PKCS#11 API 更改 PIN,可以使用名为 Pkcs11Interop 的托管 .NET 包装器从 C# 轻松访问该 API。这是我的作者。
下面是可以帮助您入门的代码示例:
using Net.Pkcs11Interop.Common;
using Net.Pkcs11Interop.HighLevelAPI;
namespace ConsoleApplication
{
class Program
{
static void Main(string[] args)
{
// Load PKCS#11 library provided by Gemalto
using (Pkcs11 pkcs11 = new Pkcs11("gtop11dotnet.dll", true))
{
// Find first slot/reader with token/card present
Slot slot = pkcs11.GetSlotList(true)[0];
// Open RW session
using (Session session = slot.OpenSession(false))
{
// Login as normal user with current PIN
session.Login(CKU.CKU_USER, "0000");
// Set the new pin for the logged in user
session.SetPin("0000", "1111");
session.Logout();
}
}
}
}
}
关于smartcard - 通过脚本更改金雅拓智能卡的 PIN,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/30491101/