com.enterprisedt.net.ftp.ssh
Class SSHFTPPublicKey

java.lang.Object
  extended by com.enterprisedt.net.ftp.ssh.SSHFTPValidator
      extended by com.enterprisedt.net.ftp.ssh.SSHFTPPublicKey

public class SSHFTPPublicKey
extends SSHFTPValidator

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
static int IETF_SECSH_FORMAT
          Specifies the IETF SECSH format.
static int OPENSSH_FORMAT
          Specifies the OpenSSH format.
 
Method Summary
 boolean equals(java.lang.Object obj)
          Indicates whether some other object is "equal to" this one.
 java.lang.String getAlgorithmName()
          Returns the name of the algorithm (either DSA or RSA).
 int getBitLength()
          Returns the bit-length of the key.
 java.lang.String getFingerprint()
          Returns the finger-print of the key.
 byte[] getKeyData()
          Returns the raw data of the key.
 int hashCode()
          Returns a hash code value for the object.
 int write(java.io.OutputStream outStr, int formatCode)
          Writes a printable representation of the key to the given stream.
 
Methods inherited from class com.enterprisedt.net.ftp.ssh.SSHFTPValidator
addKnownHost, addKnownHost, getHostPublicKey, getKnownHosts, isHostValidationEnabled, loadKnownHosts, loadKnownHosts, removeAllKnownHosts, removeKnownHost, setHostValidationEnabled, validate, validate
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

OPENSSH_FORMAT

public static final int OPENSSH_FORMAT
Specifies the OpenSSH format.

See Also:
Constant Field Values

IETF_SECSH_FORMAT

public static final int IETF_SECSH_FORMAT
Specifies the IETF SECSH format.

See Also:
Constant Field Values
Method Detail

getAlgorithmName

public java.lang.String 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

public java.lang.String getFingerprint()
Returns the finger-print of the key.

Returns:
Returns the finger-print of the key.

equals

public boolean equals(java.lang.Object obj)
Indicates whether some other object is "equal to" this one.

Overrides:
equals in class java.lang.Object
Returns:
truefalse

hashCode

public int hashCode()
Returns a hash code value for the object.

Overrides:
hashCode in class java.lang.Object
Returns:
a hash code value for this object.

write

public int write(java.io.OutputStream outStr,
                 int formatCode)
          throws SSHFTPException,
                 java.io.IOException
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 either OPENSSH_FORMAT or IETF_SECSH_FORMAT. The stream is not closed.

Parameters:
outStr - OutputStream to which to write the key.
formatCode - Format to use (either OPENSSH_FORMAT or IETF_SECSH_FORMAT).
Returns:
The number of bytes written.
Throws:
SSHFTPException - Thrown if the format-code is not OPENSSH_FORMAT or IETF_SECSH_FORMAT.
java.io.IOException - Thrown if there was an error while writing to the stream.


Copyright © 2001-2006 Enterprise Distributed Technologies Ltd. All Rights Reserved.