Sample code for 30+ languages & platforms
Java

Load a Certificate from the Windows Certificate Store

See more Certificates Examples

Demonstrates how to load a certificate that has been pre-installed in the registry-based Windows certificate store. This is generally how one would load a certificate that is stored on a smart card or usb token.

Chilkat Java Downloads

Java
import com.chilkatsoft.*;

public class ChilkatExample {

  static {
    try {
        System.loadLibrary("chilkat");
    } catch (UnsatisfiedLinkError e) {
      System.err.println("Native code library failed to load.\n" + e);
      System.exit(1);
    }
  }

  public static void main(String argv[])
  {
    boolean success = false;

    CkCert cert = new CkCert();

    success = cert.LoadByCommonName("PIVKey 7ED53EC611D3F84396212C5842BB563F");
    if (success != true) {
        System.out.println(cert.lastErrorText());
        return;
        }

    System.out.println("Loaded: " + cert.subjectDN());
  }
}