8304956: Update KeyStore.getDefaultType​() specification to return pkcs12 as fallback

Reviewed-by: hchao, mullan
This commit is contained in:
Ben Perez 2023-09-22 17:31:57 +00:00 committed by Sean Mullan
parent 373cdf257d
commit 53516aed38
3 changed files with 50 additions and 5 deletions

View file

@ -205,7 +205,7 @@ public class KeyStore {
* the default keystore type.
* In the Security properties file, the default keystore type is given as:
* <pre>
* keystore.type=jks
* keystore.type=pkcs12
* </pre>
*/
private static final String KEYSTORE_TYPE = "keystore.type";
@ -971,8 +971,7 @@ public class KeyStore {
/**
* Returns the default keystore type as specified by the
* {@code keystore.type} security property, or the string
* {@literal "jks"} (acronym for {@literal "Java keystore"})
* if no such property exists.
* {@literal "pkcs12"} if no such property exists.
*
* <p>The default keystore type can be used by applications that do not
* want to use a hard-coded keystore type when calling one of the
@ -983,7 +982,7 @@ public class KeyStore {
* {@code keystore.type} security property to the desired keystore type.
*
* @return the default keystore type as specified by the
* {@code keystore.type} security property, or the string {@literal "jks"}
* {@code keystore.type} security property, or the string {@literal "pkcs12"}
* if no such property exists.
* @see java.security.Security security properties
*/
@ -992,7 +991,7 @@ public class KeyStore {
String kstype = AccessController.doPrivileged((PrivilegedAction<String>) () ->
Security.getProperty(KEYSTORE_TYPE));
if (kstype == null) {
kstype = "jks";
kstype = "pkcs12";
}
return kstype;
}