Class KeyProviderUtil
java.lang.Object
net.schmizz.sshj.userauth.keyprovider.KeyProviderUtil
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic KeyFormat
detectKeyFileFormat
(File location) Attempts to detect how a key file is encoded.static KeyFormat
detectKeyFileFormat
(Reader privateKey, boolean separatePubKey) Attempts to detect how a key file is encoded.static KeyFormat
detectKeyFileFormat
(String privateKey, boolean separatePubKey) Attempts to detect how a key file is encoded.private static KeyFormat
keyFormatFromHeader
(String header, boolean separatePubKey) private static String
readHeader
(Reader privateKey)
-
Constructor Details
-
KeyProviderUtil
public KeyProviderUtil()
-
-
Method Details
-
detectKeyFileFormat
Attempts to detect how a key file is encoded. Return values are consistent with theNamedFactory
implementations in thekeyprovider
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 theNamedFactory
implementations in thekeyprovider
package.- Parameters:
privateKey
- Private key stored in a stringseparatePubKey
- 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 theNamedFactory
implementations in thekeyprovider
package.- Parameters:
privateKey
- Private key accessible through aReader
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
- Throws:
IOException
-
keyFormatFromHeader
-