A straightforward question. Do you have any idea if there is a possibility to change the SO-pin of a token (ePass2003 in my case) using pkcs11 Interop? Many thanks in advance.
Asked
Active
Viewed 732 times
1 Answers
4
Right now I can't find my ePass2003 to test but I would try with this code:
using Net.Pkcs11Interop.Common;
using Net.Pkcs11Interop.HighLevelAPI;
namespace ConsoleApp1
{
class Program
{
static string pkcs11Library = "opensc-pkcs11";
static string oldSoPin = "1111111111";
static string newSoPin = "2222222222";
static void Main(string[] args)
{
using (Pkcs11 pkcs11 = new Pkcs11(pkcs11Library, AppType.SingleThreaded))
{
Slot firstSlot = pkcs11.GetSlotList(SlotsType.WithTokenPresent)[0];
using (Session session = firstSlot.OpenSession(SessionType.ReadWrite))
{
session.Login(CKU.CKU_SO, oldSoPin);
session.SetPin(oldSoPin, newSoPin);
}
}
}
}
}

jariq
- 11,681
- 3
- 33
- 52
-
Tkanks a lot. I will try it tomorrow... today, actually. But I feel it will work 'cose one can change the logged in one's pin, I guess. BTW, thank you for your work at pkcs11Interop – Ady Năstase Jun 13 '18 at 21:17