I'm trying to make a simple java app that uses a security token to sign a file (any extension).
I need to read all the info from the token and sign the file with it so that I can later load the signed file, get the original file and all the other info.
Here's the sample code I have at the moment, the main problem I see is that different tokens can have different .dll and I need something like an abstraction of this.
String pkcs11config = "C:/Documents and Settings/nsaul/Escritorio/Lib/ep2pk11.cfg";
Provider p = new sun.security.pkcs11.SunPKCS11(pkcs11config);
//Use the provider
char [] pin = {'#', '#', '#', '#', '#', '#', '#', '#'};
KeyStore ks = KeyStore.getInstance("PKCS11",p);
ks.load(null, pin);
I have found a guide in C# that seems to do what I need but Java is a requirement for the project.
https://learn.microsoft.com/en-us/dotnet/standard/security/how-to-access-hardware-encryption-devices