Class KeyProviderUtil

java.lang.Object
net.schmizz.sshj.userauth.keyprovider.KeyProviderUtil

public class KeyProviderUtil extends Object
  • Constructor Details

    • KeyProviderUtil

      public KeyProviderUtil()
  • Method Details

    • detectKeyFileFormat

      public static KeyFormat detectKeyFileFormat(File location) throws 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:
      IOException - Thrown on file processing failures
    • detectKeyFileFormat

      public static KeyFormat detectKeyFileFormat(String privateKey, boolean separatePubKey) throws 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:
      IOException - Thrown on file processing failures
    • detectKeyFileFormat

      public static KeyFormat detectKeyFileFormat(Reader privateKey, boolean separatePubKey) throws 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:
      IOException - Thrown on file processing failures
    • readHeader

      private static String readHeader(Reader privateKey) throws IOException
      Throws:
      IOException
    • keyFormatFromHeader

      private static KeyFormat keyFormatFromHeader(String header, boolean separatePubKey)