Package org.wildfly.security.credential
Class SSHCredential
- java.lang.Object
-
- org.wildfly.security.credential.SSHCredential
-
- All Implemented Interfaces:
Cloneable
,Credential
public class SSHCredential extends Object implements Credential
A credential holding the location, key identity and passphrase (instance ofCredential
) of a Private key in an external file and/or the name of the file containing the known hosts- Author:
- Ashley Abdel-Sayed
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
SSHCredential.Builder
A builder for SSHCredential.
-
Field Summary
Fields Modifier and Type Field Description static String
DEFAULT_KNOWN_HOSTS
static String[]
DEFAULT_PRIVATE_KEYS
static File
DEFAULT_SSH_DIRECTORY
private String
knownHostsFile
private Credential
passphrase
private String[]
privateKeyIdentities
private File
sshDirectory
-
Fields inherited from interface org.wildfly.security.credential.Credential
NO_CREDENTIALS
-
-
Constructor Summary
Constructors Modifier Constructor Description private
SSHCredential(File sshDirectory, String[] privateKeyIdentities, Credential passphrase, String knownHostsFile)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static SSHCredential.Builder
builder()
Credential
clone()
Creates and returns a copy of thisCredential
.boolean
equals(Object obj)
private boolean
equals(SSHCredential obj)
String
getKnownHostsFile()
Get the file containing the known SSH hostsCredential
getPassphrase()
Get the passphrase used to decrypt the private keyString[]
getPrivateKeyIdentities()
Get the list of private key file namesFile
getSshDirectory()
Get the SSH directory containing the private key file and known hosts fileint
hashCode()
-
Methods inherited from class java.lang.Object
finalize, getClass, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface org.wildfly.security.credential.Credential
canVerify, canVerify, castAndApply, castAndApply, castAndApply, castAs, castAs, castAs, matches, matches, matches, verify, verify
-
-
-
-
Field Detail
-
DEFAULT_SSH_DIRECTORY
public static File DEFAULT_SSH_DIRECTORY
-
DEFAULT_PRIVATE_KEYS
public static String[] DEFAULT_PRIVATE_KEYS
-
DEFAULT_KNOWN_HOSTS
public static String DEFAULT_KNOWN_HOSTS
-
sshDirectory
private final File sshDirectory
-
privateKeyIdentities
private final String[] privateKeyIdentities
-
passphrase
private final Credential passphrase
-
knownHostsFile
private final String knownHostsFile
-
-
Constructor Detail
-
SSHCredential
private SSHCredential(File sshDirectory, String[] privateKeyIdentities, Credential passphrase, String knownHostsFile)
- Parameters:
sshDirectory
- the ssh directoryprivateKeyIdentities
- an array containing the name of the file(s) containing the private keypassphrase
- the passphrase used to decrypt the private key (if applicable)knownHostsFile
- the name of the file containing the known hosts
-
-
Method Detail
-
getSshDirectory
public File getSshDirectory()
Get the SSH directory containing the private key file and known hosts file- Returns:
- the SSH directory
-
getPrivateKeyIdentities
public String[] getPrivateKeyIdentities()
Get the list of private key file names- Returns:
- the private key identities
-
getPassphrase
public Credential getPassphrase()
Get the passphrase used to decrypt the private key- Returns:
- the passphrase
-
getKnownHostsFile
public String getKnownHostsFile()
Get the file containing the known SSH hosts- Returns:
- the known hosts file name
-
clone
public Credential clone()
Description copied from interface:Credential
Creates and returns a copy of thisCredential
.- Specified by:
clone
in interfaceCredential
- Overrides:
clone
in classObject
- Returns:
- a copy of this
Credential
.
-
equals
private boolean equals(SSHCredential obj)
-
builder
public static SSHCredential.Builder builder()
-
-