Class KeyProviderUtil
- java.lang.Object
-
- net.schmizz.sshj.userauth.keyprovider.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)
-
-
-
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 theNamedFactory
implementations in thekeyprovider
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 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:
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 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:
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)
-
-