Class Crypt32ExtUtil
java.lang.Object
org.jetbrains.nativecerts.win32.Crypt32ExtUtil
Get custom (enterprise/user-installed) trusted root certificates from Windows certificate stores via CryptoAPI.
Native handles and structures are opaque
Native handles and structures are opaque
MemorySegments; see Crypt32Ext for the bindings
and WinCryptStructures for the structure layouts.-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic List<X509Certificate> gatherEnterpriseCertsForLocation(int location, String storeName) Enumerates all certificates of one physical system store.static Collection<X509Certificate> Certificates from the "ROOT" stores of allcustomTrustedCertificatesLocationsplus those intermediate ("CA" store) certificates that Windows itself can validate up to a trusted root.static voidvalidateCertificate(byte[] encodedCertificate) Asks Windows to build a certificate chain for the given certificate (offline, using cached revocation data only) and to verify it against the SSL policy.
-
Constructor Details
-
Crypt32ExtUtil
public Crypt32ExtUtil()
-
-
Method Details
-
getCustomTrustedRootCertificates
Certificates from the "ROOT" stores of allcustomTrustedCertificatesLocationsplus those intermediate ("CA" store) certificates that Windows itself can validate up to a trusted root. -
gatherEnterpriseCertsForLocation
public static List<X509Certificate> gatherEnterpriseCertsForLocation(int location, String storeName) Enumerates all certificates of one physical system store.- Parameters:
location- One ofCERT_SYSTEM_STORE_*constantsstoreName- Logical store name, e.g. "ROOT" or "CA"- Returns:
- Parsed certificates; an empty list if the store does not exist
-
validateCertificate
public static void validateCertificate(byte[] encodedCertificate) Asks Windows to build a certificate chain for the given certificate (offline, using cached revocation data only) and to verify it against the SSL policy.- Throws:
WindowsCertificateException- if the chain cannot be built or does not satisfy the policy, e.g. withCrypt32Ext.CERT_E_UNTRUSTEDROOTwhen the root is not trusted
-