Java
Java
Windows Certificate Stores - Find Certificate by Common Name
See more Certificates Examples
Searches the Windows certificate stores for a certificate that matches the specified common name (CN).Note: This example requires Chilkat v10.0.0 or greater.
Chilkat Java Downloads
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("Chilkat Software, Inc.");
if (success == false) {
System.out.println(cert.lastErrorText());
return;
}
System.out.println(cert.subjectDN());
System.out.println("Success.");
}
}