com.maverick.ssh2
Class Ssh2DsaPublicKey

java.lang.Object
  extended bycom.maverick.crypto.publickey.DsaKey
      extended bycom.maverick.crypto.publickey.DsaPublicKey
          extended bycom.maverick.ssh2.Ssh2DsaPublicKey
All Implemented Interfaces:
com.maverick.crypto.publickey.PublicKey, SshPublicKey

public class Ssh2DsaPublicKey
extends com.maverick.crypto.publickey.DsaPublicKey
implements SshPublicKey

Represents an SSH2 DSA public key.

Author:
Lee David Painter

Field Summary
 
Fields inherited from class com.maverick.crypto.publickey.DsaPublicKey
y
 
Fields inherited from class com.maverick.crypto.publickey.DsaKey
g, p, q
 
Constructor Summary
Ssh2DsaPublicKey()
          Default contructor used to initialize the key from an encoded byte array using the init method.
Ssh2DsaPublicKey(java.math.BigInteger p, java.math.BigInteger q, java.math.BigInteger g, java.math.BigInteger y)
          Construct a DSA key from the parameters.
 
Method Summary
 boolean equals(java.lang.Object obj)
           
 java.lang.String getAlgorithm()
          The algorithm name is "ssh-dss"
 byte[] getEncoded()
          Returns the key encoded into a byte array as defined in the SSH Transport Protocol.
 java.lang.String getFingerprint()
          Return an SSH fingerprint of the public key
 int hashCode()
           
 void init(byte[] blob, int start, int len)
          Initialize the public key from an SSH2 key blob
 boolean verifySignature(byte[] signature, byte[] data)
          Verify the signature.
 
Methods inherited from class com.maverick.crypto.publickey.DsaPublicKey
getBitLength, getY, verifySignature
 
Methods inherited from class com.maverick.crypto.publickey.DsaKey
getG, getP, getQ
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface com.maverick.ssh.SshPublicKey
getBitLength
 

Constructor Detail

Ssh2DsaPublicKey

public Ssh2DsaPublicKey(java.math.BigInteger p,
                        java.math.BigInteger q,
                        java.math.BigInteger g,
                        java.math.BigInteger y)
Construct a DSA key from the parameters.

Parameters:
p -
q -
g -
y -

Ssh2DsaPublicKey

public Ssh2DsaPublicKey()
Default contructor used to initialize the key from an encoded byte array using the init method.

Method Detail

getAlgorithm

public java.lang.String getAlgorithm()
The algorithm name is "ssh-dss"

Specified by:
getAlgorithm in interface SshPublicKey
Returns:
the algorithm name, for example "ssh-dss"

getEncoded

public byte[] getEncoded()
                  throws SshException
Returns the key encoded into a byte array as defined in the SSH Transport Protocol.
The "ssh-dss" public key format has the following specific encoding:

  String         "ssh-dss"
  BigInteger     p
  BigInteger     q
  BigInteger     g
  BigInteger     y

Specified by:
getEncoded in interface SshPublicKey
Returns:
the encoded format.
Throws:
SshException

getFingerprint

public java.lang.String getFingerprint()
                                throws SshException
Description copied from interface: SshPublicKey
Return an SSH fingerprint of the public key

Specified by:
getFingerprint in interface SshPublicKey
Returns:
Throws:
SshException

init

public void init(byte[] blob,
                 int start,
                 int len)
          throws SshException
Initialize the public key from an SSH2 key blob

Specified by:
init in interface SshPublicKey
Parameters:
start - the offset in the key data to start reading
len - the length of the key data
blob -
Throws:
java.io.IOException
SshException

verifySignature

public boolean verifySignature(byte[] signature,
                               byte[] data)
Description copied from interface: SshPublicKey
Verify the signature.

Specified by:
verifySignature in interface SshPublicKey
Parameters:
signature -
Returns:
true if the signature is valid, otherwise false

equals

public boolean equals(java.lang.Object obj)

hashCode

public int hashCode()


Copyright © 2003 3SP LTD. All Rights Reserved.