public interface SshIdentityManager
To be able to store a SshPublicKey or SshPrivateKey, they
must first be turned into SshPublicKeyFile or
SshPrivateKeyFile objects respectively.
From these, a byte array that is formatted in the appropriate way can then be obtained and persisted however you wish.
| Modifier and Type | Method and Description |
|---|---|
SshPrivateKeyFile |
create(SshKeyPair pair,
int format,
char[] passphrase,
java.lang.String comment)
Create a
SshPrivateKeyFile that will allow you obtain a formatted
version of a SshPrivateKey for storage. |
SshPublicKeyFile |
create(SshPublicKey key,
java.lang.String options,
java.lang.String comment,
int format)
Create a Public Key File that may be used to write authorized_keys files
or other public key storage systems.
|
SshPrivateKeyFile |
createPrivateKeyFromStream(java.io.InputStream in)
Parse a stream that provides a private key in some supported format.
|
SshPublicKeyFile |
createPublicKeyFromStream(java.io.InputStream in)
Parse a stream that provides a public key in some supported format.
|
SshKeyPair |
generateKeyPair(java.lang.String keyType,
int keyBits)
Generate a new key pair.
|
java.util.List |
getSupportedKeyLengths()
Get a list of all the supported key lengths.
|
java.util.List |
getSupportedKeyTypes()
Get a list of all the supported key types.
|
java.util.List |
getSupportedPrivateKeyFileFormats()
Get a list of all the supported private key file formats that may be
created.
|
java.util.List |
getSupportedPublicKeyFileFormats()
Get a list of all the supported public key file formats that may be
created.
|
SshPublicKeyFile createPublicKeyFromStream(java.io.InputStream in) throws SshException
SshPublicKeyFile so may
then be persisted elsewhere if you wish, or you can just obtain the
SshPublicKey.in - stream to read key fromSshException - if the raw data cannot be parsed into a public keySshPrivateKeyFile createPrivateKeyFromStream(java.io.InputStream in) throws SshException
SshPrivateKeyFile so may
then be persisted elsewhere if you wish, or you can just obtain the
SshPrivateKeyFile.in - stream to read key fromSshException - if the raw data cannot be parsed into a private keySshKeyPair generateKeyPair(java.lang.String keyType, int keyBits) throws SshException
SshProvider.seed(long).keyType - key type.keyBits - key lengthSshException - if pair cannot be generated.SshPrivateKeyFile create(SshKeyPair pair, int format, char[] passphrase, java.lang.String comment) throws SshException
SshPrivateKeyFile that will allow you obtain a formatted
version of a SshPrivateKey for storage. The public key is
required for this, so SshKeyPair containing the private key is
required. See SshPrivateKeyFile for possible format codes.
Note, not all key formats support the optional comment field.
pair - key pairformat - formatpassphrase - passphrase if you want the key encrypted, null if notcomment - comment if supported by formatSshExceptionjava.util.List getSupportedKeyTypes()
String which will be one of
SshConfiguration.PUBLIC_KEY_SSHDSA,
SshConfiguration.PUBLIC_KEY_SSHRSA or
SshConfiguration.PUBLIC_KEY_SSHDSA.java.util.List getSupportedKeyLengths()
Integer whose value is the key size in bits.java.util.List getSupportedPublicKeyFileFormats()
Integer whose value
corresponds to one of the format codes in SshPublicKeyFileSshPublicKeyFilejava.util.List getSupportedPrivateKeyFileFormats()
Integer whose value
corresponds to one of the format codes in SshPrivateKeyFileSshPublicKeyFileSshPublicKeyFile create(SshPublicKey key, java.lang.String options, java.lang.String comment, int format) throws SshException
key - public key to useoptions - additional options when supported by the formatcomment - comment when supported by the formatformat - key format. See SshPublicKeyFile for format types.SshException - if public key file may not be createdCopyright © 2018. All rights reserved.