I am using Aladdin etoken and am able to read the certificate from it. Now I have to create a .jks with the Certificate. How do I export the Certificate from the smart card and create a .jks file? Thanks.
Please try this following code. Here, I am creating a keystore for JKS and make entry for my certificate under a preferable alias. Finally write the file (example: demo.jks)
X509Certificate x509Certificate = Util.getX509Cert(x509FileLocation);
KeyStore store = KeyStore.getInstance("JKS");
store.load(null, null);
store.setCertificateEntry("alias", x509Certificate);
FileOutputStream fileOutputStream = new FileOutputStream(jksFileLocation);
store.store(fileOutputStream, "123456".toCharArray());
Hopefully it will work.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.