Package com.enterprisedt.net.ftp.ssh
Class SSHFTPPublicKey
java.lang.Object
com.enterprisedt.net.ftp.ssh.SSHFTPPublicKey
Represents an SSH public key.
This class may be used to obtain information about a public key.
It has methods for accessing the name of the algorithm, the bit length,
the key data, the fingerprint, as well as a method for writing the
key to a stream in either OpenSSH or IETF SECSH format.
- Author:
- Hans Andersen
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final intSpecifies the IETF SECSH format.static final intSpecifies the OpenSSH format. -
Method Summary
Modifier and TypeMethodDescriptionbooleanIndicates whether some other object is "equal to" this one.Returns the name of the algorithm (either DSA or RSA).intReturns the bit-length of the key.Returns the finger-print of the key.byte[]Returns the raw data of the key.inthashCode()Returns a hash code value for the object.intwrite(OutputStream outStr, int formatCode) Writes a printable representation of the key to the given stream.
-
Field Details
-
OPENSSH_FORMAT
public static final int OPENSSH_FORMATSpecifies the OpenSSH format.- See Also:
-
IETF_SECSH_FORMAT
public static final int IETF_SECSH_FORMATSpecifies the IETF SECSH format.- See Also:
-
-
Method Details
-
getAlgorithmName
Returns the name of the algorithm (either DSA or RSA).- Returns:
- Returns the name of the algorithm (either DSA or RSA).
-
getBitLength
public int getBitLength()Returns the bit-length of the key.- Returns:
- Returns the bit-length of the key.
-
getKeyData
public byte[] getKeyData()Returns the raw data of the key.- Returns:
- Returns the raw data of the key.
-
getFingerprint
Returns the finger-print of the key.- Returns:
- Returns the finger-print of the key.
-
equals
Indicates whether some other object is "equal to" this one. -
hashCode
public int hashCode()Returns a hash code value for the object. -
write
Writes a printable representation of the key to the given stream. This method writes a printable representation of the key to the given stream. The format in which it is written is determined by the format parameter and should be eitherOPENSSH_FORMATorIETF_SECSH_FORMAT. The stream is not closed.- Parameters:
outStr- OutputStream to which to write the key.formatCode- Format to use (eitherOPENSSH_FORMATorIETF_SECSH_FORMAT).- Returns:
- The number of bytes written.
- Throws:
SSHFTPException- Thrown if the format-code is notOPENSSH_FORMATorIETF_SECSH_FORMAT.IOException- Thrown if there was an error while writing to the stream.
-