我们必须使用Gemalto IDPrime .Net卡智能卡。我们得到了这些USB软线,并必须改变密码。
Gemalto通过窗口说:
在“开始”菜单中,选择“运行”并键入PINTool。按提示在读取器中插入IDPrime .Net卡,然后单击OK。更改的PIN接口将出现在旧的PIN中(默认的PIN值为0000),新的PIN并确认新的PIN。点击变更针 idprime#.VWYTWUa8rV8
这是可行的,但我想通过powershell或c#设置一个新的PIN/密码,即在程序控制下。怎么做还是不可能?
发布于 2015-05-27 21:11:29
您应该能够通过非托管PKCS#11 API更改PIN,该API可以通过一个名为Pkcs11Interop的托管.NET包装器轻松地从.NET访问。
下面是可以帮助您入门的代码示例:
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();
}
}
}
}
}https://stackoverflow.com/questions/30491101
复制相似问题