Java Requires Chilkat v10.1.2+
Chilkat2 Java
List Certificates in the Current User Certificate Store (Windows Only)
See more Certificates Examples
This is a Windows-only example to list the certificates in the current-user certificate store (located in the Windows Registry).Chilkat Java Downloads
import com.chilkatsoft.chilkat2.Cert;
import com.chilkatsoft.chilkat2.CertStore;
import com.chilkatsoft.chilkat2.ChilkatException;
public class ChilkatExample {
public static void main(String[] args) {
// This is a Windows-only example because it lists the certificates
// stored in the Windows Current User Certificate Store located in the
// Windows Registry.
CertStore certStore = new CertStore();
boolean readOnly = true;
try {
certStore.openCurrentUserStore(readOnly);
} catch (ChilkatException e) {
System.out.println(e.getLastErrorText());
return;
}
Cert cert = new Cert();
int numCerts = certStore.getNumCertificates();
int i = 0;
while (i < numCerts) {
certStore.getCert(i, cert);
System.out.println("DN = " + cert.getSubjectDN());
System.out.println("Email = " + cert.getSubjectE());
i = i + 1;
}
}
}