javacertificatecertificate-store

How to access the Java Certificate Store with Java?


I found out that Java has its own "Certificate Store" which is located in a file in the security-folder inside the lib-folder.

You could access this from the Java Control Panel -> Security -> Manage Certificates.

But I want to access them via Java-Code. Does someone have some information about this? How the certificates are stored inside the certificate-File? Is there a Java built-in way for this?


Solution

  • Look at the java keystore, it may helps you:

    http://docs.oracle.com/cd/E19830-01/819-4712/ablqw/index.html

    https://www.digitalocean.com/community/tutorials/java-keytool-essentials-working-with-java-keystores

    http://docs.oracle.com/javase/7/docs/api/java/security/KeyStore.html

    Exemples of importing certificates in java:

    Programmatically Import CA trust cert into existing keystore file without using keytool

    programmatically import .cer certificate into keystore