I'm trying to get a certificate from local machine Windows store. What a want to get is a certificate in the patth "Certificates(Local Computer) --> Personal --> Certificates".
I used this code to access certificate in the path "Certificates - Current User --> Personal --> Certificates
NativeLibrary crypt32 = NativeLibrary.getInstance("Crypt32");
Function functionCertOpenSystemStore =
crypt32.getFunction("CertOpenSystemStoreA");
Object[] argsCertOpenSystemStore = new Object[] { 0, "MY"};
HANDLE h = (HANDLE) functionCertOpenSystemStore.invoke(HANDLE.class, argsCertOpenSystemStore);
Any idea about how to get a certificate from "Certificates(Local Computer) --> Personal --> Certificates"?
I'm trying to use JNA because I read is not posible to access local machine certificates from Java. I only thing I've got is to get "Current user" certificates using keystore like this :
KeyStore ks = KeyStore.getInstance("Windows-MY", "SunMSCAPI");
Also I've tried this :
KeyStore ks = KeyStore.getInstance("Windows-ROOT", "SunMSCAPI");
Can someone give me a clue?