| JDK 11 | JDK 17 | JDK 19 |
|---|---|---|
| 11.0.18Fixed | 17.0.5Fixed | 19 b23Fixed |
|
CSR :
|
|
|
Relates :
|
|
|
Relates :
|
|
JDK-8286141 :
|
|
|
JDK-8286790 :
|
A DESCRIPTION OF THE REQUEST :
Only 2 keystore types are available with the SunMSCAPI provider (Windows-MY / Windows-ROOT)..
None of this 2 types allows to retrieve the local computer certificates, only the user ertificates can be seen.
JUSTIFICATION :
There is no way to access the local computer certificates using java.
EXPECTED VERSUS ACTUAL BEHAVIOR :
EXPECTED -
Either define a new store type like Windows-LOCALCOMPUTER,
or also list the computer local certificates when using the Windows-MY store type.
ACTUAL -
Listing the certificates using the Windows-MY keystore only retrieves the user cerficiates, excluding the local computer certificates.
---------- BEGIN SOURCE ----------
// first make sure to have a computer certificate installed in the windows local computer keystore
// use the certificate managament console if necessary (MMC), select the certificates component, then select computer account instead of user account
// then this code will list the certificates found by the SunMSCAPI provider
try {
KeyStore ks = KeyStore.getInstance("Windows-MY");
ks.load(null, null) ;
Enumeration<String> en = ks.aliases() ;
while (en.hasMoreElements()) {
String aliasKey = (String)en.nextElement() ;
X509Certificate c = (X509Certificate)ks.getCertificate(aliasKey) ;
System.out.println("---> alias : " + aliasKey) ;
System.out.println(" Certificat subjectDN : " + c.getSubjectDN() ) ;
System.out.println(" Certificat issuerDN : " + c.getIssuerDN() ) ;
}
} catch (Exception e) {
e.printStackTrace();
}
---------- END SOURCE ----------
|