Enum KeyStoreFileType

  • All Implemented Interfaces:
    java.io.Serializable, java.lang.Comparable<KeyStoreFileType>

    public enum KeyStoreFileType
    extends java.lang.Enum<KeyStoreFileType>
    This enum represents the file type of a KeyStore or TrustStore. Currently, JKS (Java keystore), PEM, PKCS12, and BCFKS types are supported.
    • Enum Constant Summary

      Enum Constants 
      Enum Constant Description
      BCFKS  
      JKS  
      PEM  
      PKCS12  
    • Method Summary

      All Methods Static Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      static KeyStoreFileType fromFilename​(java.lang.String filename)
      Detects the type of KeyStore / TrustStore file from the file extension.
      static KeyStoreFileType fromPropertyValue​(java.lang.String propertyValue)
      Converts a property value to a StoreFileType enum.
      static KeyStoreFileType fromPropertyValueOrFileName​(java.lang.String propertyValue, java.lang.String filename)
      If propertyValue is not null or empty, returns the result of KeyStoreFileType.fromPropertyValue(propertyValue).
      java.lang.String getDefaultFileExtension()
      The file extension that is associated with this file type.
      java.lang.String getPropertyValue()
      The property string that specifies that a key store or trust store should use this store file type.
      static KeyStoreFileType valueOf​(java.lang.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.
      • Methods inherited from class java.lang.Enum

        clone, compareTo, equals, finalize, getDeclaringClass, hashCode, name, ordinal, toString, valueOf
      • Methods inherited from class java.lang.Object

        getClass, notify, notifyAll, wait, wait, wait
    • Method Detail

      • values

        public static KeyStoreFileType[] values()
        Returns an array containing the constants of this enum type, in the order they are declared. This method may be used to iterate over the constants as follows:
        for (KeyStoreFileType c : KeyStoreFileType.values())
            System.out.println(c);
        
        Returns:
        an array containing the constants of this enum type, in the order they are declared
      • valueOf

        public static KeyStoreFileType valueOf​(java.lang.String name)
        Returns the enum constant of this type with the specified name. The string must match exactly an identifier used to declare an enum constant in this type. (Extraneous whitespace characters are not permitted.)
        Parameters:
        name - the name of the enum constant to be returned.
        Returns:
        the enum constant with the specified name
        Throws:
        java.lang.IllegalArgumentException - if this enum type has no constant with the specified name
        java.lang.NullPointerException - if the argument is null
      • getPropertyValue

        public java.lang.String getPropertyValue()
        The property string that specifies that a key store or trust store should use this store file type.
      • getDefaultFileExtension

        public java.lang.String getDefaultFileExtension()
        The file extension that is associated with this file type.
      • fromPropertyValue

        public static KeyStoreFileType fromPropertyValue​(java.lang.String propertyValue)
        Converts a property value to a StoreFileType enum. If the property value is null or an empty string, returns null.
        Parameters:
        propertyValue - the property value.
        Returns:
        the KeyStoreFileType, or null if propertyValue is null or empty.
        Throws:
        java.lang.IllegalArgumentException - if propertyValue is not one of "JKS", "PEM", "BCFKS", "PKCS12", or empty/null.
      • fromFilename

        public static KeyStoreFileType fromFilename​(java.lang.String filename)
        Detects the type of KeyStore / TrustStore file from the file extension. If the file name ends with ".jks", returns 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.
        Parameters:
        filename - the filename of the key store or trust store file.
        Returns:
        a KeyStoreFileType.
        Throws:
        java.lang.IllegalArgumentException - if the filename does not end with ".jks", ".pem", "p12" or "bcfks".
      • fromPropertyValueOrFileName

        public static KeyStoreFileType fromPropertyValueOrFileName​(java.lang.String propertyValue,
                                                                   java.lang.String filename)
        If propertyValue is not null or empty, returns the result of KeyStoreFileType.fromPropertyValue(propertyValue). Else, returns the result of KeyStoreFileType.fromFileName(filename).
        Parameters:
        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.
        Returns:
        a KeyStoreFileType.
        Throws:
        java.lang.IllegalArgumentException - if propertyValue is not one of "JKS", "PEM", "PKCS12", "BCFKS", or empty/null.
        java.lang.IllegalArgumentException - if propertyValueis empty or null and the type could not be determined from the file name.