How to access certificate from eToken in java

I want to read the certificate from eToken, when it is connected, when I store this certificate on the local computer, I can read it through my Java application, but I do not know how to read it from eToken.

RSAPublicKey pub; String fileName = "C:\\myCert.cer"; InputStream inStream = new FileInputStream(fileName); CertificateFactory cf = CertificateFactory.getInstance("X.509"); X509Certificate cert = (X509Certificate)cf.generateCertificate(inStream); inStream.close(); pub = (RSAPublicKey) cert.getPublicKey(); System.out.println(cert.getIssuerDN()); System.out.println(cert.getSubjectDN()); System.out.println(cert.getSubjectAlternativeNames()); byte [] tempPub = pub.getEncoded(); String sPub = new String( tempPub ); 
+3
java certificate cryptography encryption devicetoken
source share
1 answer

One way to do this is to use the PKCS # 11 provider . It also contains examples.

+4
source share

All Articles