Class KeyProviderUtil


  • public class KeyProviderUtil
    extends java.lang.Object
    • Constructor Summary

      Constructors 
      Constructor Description
      KeyProviderUtil()  
    • Method Summary

      All Methods Static Methods Concrete Methods 
      Modifier and Type Method Description
      static KeyFormat detectKeyFileFormat​(java.io.File location)
      Attempts to detect how a key file is encoded.
      static KeyFormat detectKeyFileFormat​(java.io.Reader privateKey, boolean separatePubKey)
      Attempts to detect how a key file is encoded.
      static KeyFormat detectKeyFileFormat​(java.lang.String privateKey, boolean separatePubKey)
      Attempts to detect how a key file is encoded.
      private static KeyFormat keyFormatFromHeader​(java.lang.String header, boolean separatePubKey)  
      private static java.lang.String readHeader​(java.io.Reader privateKey)  
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • KeyProviderUtil

        public KeyProviderUtil()
    • Method Detail

      • detectKeyFileFormat

        public static KeyFormat detectKeyFileFormat​(java.io.File location)
                                             throws java.io.IOException
        Attempts to detect how a key file is encoded.

        Return values are consistent with the NamedFactory implementations in the keyprovider package.

        Parameters:
        location - File Path to key
        Returns:
        name of the key file format
        Throws:
        java.io.IOException - Thrown on file processing failures
      • detectKeyFileFormat

        public static KeyFormat detectKeyFileFormat​(java.lang.String privateKey,
                                                    boolean separatePubKey)
                                             throws java.io.IOException
        Attempts to detect how a key file is encoded.

        Return values are consistent with the NamedFactory implementations in the keyprovider package.

        Parameters:
        privateKey - Private key stored in a string
        separatePubKey - Is the public key stored separately from the private key
        Returns:
        name of the key file format
        Throws:
        java.io.IOException - Thrown on file processing failures
      • detectKeyFileFormat

        public static KeyFormat detectKeyFileFormat​(java.io.Reader privateKey,
                                                    boolean separatePubKey)
                                             throws java.io.IOException
        Attempts to detect how a key file is encoded.

        Return values are consistent with the NamedFactory implementations in the keyprovider package.

        Parameters:
        privateKey - Private key accessible through a Reader
        separatePubKey - Is the public key stored separately from the private key
        Returns:
        name of the key file format
        Throws:
        java.io.IOException - Thrown on file processing failures
      • readHeader

        private static java.lang.String readHeader​(java.io.Reader privateKey)
                                            throws java.io.IOException
        Throws:
        java.io.IOException
      • keyFormatFromHeader

        private static KeyFormat keyFormatFromHeader​(java.lang.String header,
                                                     boolean separatePubKey)