@InterfaceAudience.Private public enum KeyStoreFileType extends Enum<KeyStoreFileType>
Modifier and Type | Field and Description |
---|---|
private String |
defaultFileExtension |
Modifier and Type | Method and Description |
---|---|
static KeyStoreFileType |
fromFilename(String filename)
Detects the type of KeyStore / TrustStore file from the file extension.
|
static KeyStoreFileType |
fromPropertyValue(String propertyValue)
Converts a property value to a StoreFileType enum.
|
static KeyStoreFileType |
fromPropertyValueOrFileName(String propertyValue,
String filename)
If
propertyValue is not null or empty, returns the result of
KeyStoreFileType.fromPropertyValue(propertyValue) . |
String |
getDefaultFileExtension()
The file extension that is associated with this file type.
|
String |
getPropertyValue()
The property string that specifies that a key store or trust store should use this store file
type.
|
static KeyStoreFileType |
valueOf(String name)
Returns the enum constant of this type with the specified name.
|
static KeyStoreFileType[] |
values()
Returns an array containing the constants of this enum type, in
the order they are declared.
|
public static final KeyStoreFileType JKS
public static final KeyStoreFileType PEM
public static final KeyStoreFileType PKCS12
public static final KeyStoreFileType BCFKS
private final String defaultFileExtension
public static KeyStoreFileType[] values()
for (KeyStoreFileType c : KeyStoreFileType.values()) System.out.println(c);
public static KeyStoreFileType valueOf(String name)
name
- the name of the enum constant to be returned.IllegalArgumentException
- if this enum type has no constant with the specified nameNullPointerException
- if the argument is nullpublic String getPropertyValue()
public String getDefaultFileExtension()
public static KeyStoreFileType fromPropertyValue(String propertyValue)
null
or an empty string, returns null
.propertyValue
- the property value.null
if propertyValue
is
null
or empty.IllegalArgumentException
- if propertyValue
is not one of "JKS", "PEM",
"BCFKS", "PKCS12", or empty/null.public static KeyStoreFileType fromFilename(String filename)
StoreFileType.JKS
. If the file name ends with ".pem", returns
StoreFileType.PEM
. If the file name ends with ".p12", returns
StoreFileType.PKCS12
. If the file name ends with ".bckfs", returns
StoreFileType.BCKFS
. Otherwise, throws an IllegalArgumentException.filename
- the filename of the key store or trust store file.IllegalArgumentException
- if the filename does not end with ".jks", ".pem", "p12" or
"bcfks".public static KeyStoreFileType fromPropertyValueOrFileName(String propertyValue, String filename)
propertyValue
is not null or empty, returns the result of
KeyStoreFileType.fromPropertyValue(propertyValue)
. Else, returns the result of
KeyStoreFileType.fromFileName(filename)
.propertyValue
- property value describing the KeyStoreFileType, or null/empty to
auto-detect the type from the file name.filename
- file name of the key store file. The file extension is used to auto-detect
the KeyStoreFileType when propertyValue
is null or empty.IllegalArgumentException
- if propertyValue
is not one of "JKS", "PEM",
"PKCS12", "BCFKS", or empty/null.IllegalArgumentException
- if propertyValue
is empty or null and the type
could not be determined from the file name.Copyright © 2007–2020 The Apache Software Foundation. All rights reserved.