public final class PublicKeySshCredential extends SshCredential
This class optionally provides a path to the private key on the file system,
which is useful to interoperate with external commands like rsync
which may not take keys directly. For this reason, clients are encourages to
use the fromFile
factory method when the
private key is stored in a file.
Modifier and Type | Method and Description |
---|---|
void |
authenticate(SshAuthenticator authenticator) |
static PublicKeySshCredential |
fromFile(String username,
Path privateKeyFile) |
Optional<Path> |
getKeyPath()
Returns the path of the private key used by this credential if it is
available.
|
byte[] |
getPrivateKey() |
static PublicKeySshCredential |
of(String username,
byte[] privateKey) |
static PublicKeySshCredential |
of(String username,
String privateKey) |
getUsername
public static PublicKeySshCredential of(String username, String privateKey)
public static PublicKeySshCredential of(String username, byte[] privateKey)
public static PublicKeySshCredential fromFile(String username, Path privateKeyFile) throws IOException
IOException
public void authenticate(SshAuthenticator authenticator) throws IOException
authenticate
in class com.palantir.giraffe.host.Credential<SshAuthenticator>
IOException
public byte[] getPrivateKey()