com.maverick.ssh.components.jce
Class Ssh2DsaPublicKey

java.lang.Object
  extended bycom.maverick.ssh.components.jce.Ssh2DsaPublicKey
All Implemented Interfaces:
SshDsaPublicKey, SshPublicKey

public class Ssh2DsaPublicKey
extends java.lang.Object
implements SshDsaPublicKey

A DSA public key implementation which uses a JCE provider.

Author:
Lee David Painter

Field Summary
protected  java.security.interfaces.DSAPublicKey pubkey
           
 
Constructor Summary
Ssh2DsaPublicKey()
           
Ssh2DsaPublicKey(java.math.BigInteger p, java.math.BigInteger q, java.math.BigInteger g, java.math.BigInteger y)
           
Ssh2DsaPublicKey(java.security.interfaces.DSAPublicKey pub)
           
 
Method Summary
 boolean equals(java.lang.Object obj)
           
 java.lang.String getAlgorithm()
          Get the algorithm name for the public key.
 int getBitLength()
          Get the bit length of the public key
 byte[] getEncoded()
          Encode the public key into a blob of binary data, the encoded result will be passed into init to recreate the key.
 java.lang.String getFingerprint()
          Return an SSH fingerprint of the public key
 java.math.BigInteger getG()
           
 java.math.BigInteger getP()
           
 java.math.BigInteger getQ()
           
 java.math.BigInteger getY()
           
 int hashCode()
           
 void init(byte[] blob, int start, int len)
          Initialize the public key from a blob of binary data.
 boolean verifySignature(byte[] signature, byte[] data)
          Verify the signature.
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

pubkey

protected java.security.interfaces.DSAPublicKey pubkey
Constructor Detail

Ssh2DsaPublicKey

public Ssh2DsaPublicKey()

Ssh2DsaPublicKey

public Ssh2DsaPublicKey(java.security.interfaces.DSAPublicKey pub)

Ssh2DsaPublicKey

public Ssh2DsaPublicKey(java.math.BigInteger p,
                        java.math.BigInteger q,
                        java.math.BigInteger g,
                        java.math.BigInteger y)
                 throws java.security.NoSuchAlgorithmException,
                        java.security.spec.InvalidKeySpecException
Method Detail

getAlgorithm

public java.lang.String getAlgorithm()
Get the algorithm name for the public key.

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

getBitLength

public int getBitLength()
Description copied from interface: SshPublicKey
Get the bit length of the public key

Specified by:
getBitLength in interface SshPublicKey
Returns:
the bit length of the public key

getEncoded

public byte[] getEncoded()
                  throws SshException
Encode the public key into a blob of binary data, the encoded result will be passed into init to recreate the key.

Specified by:
getEncoded in interface SshPublicKey
Returns:
an encoded byte array
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:
java.lang.String
Throws:
SshException

init

public void init(byte[] blob,
                 int start,
                 int len)
          throws SshException
Initialize the public key from a blob of binary data.

Specified by:
init in interface SshPublicKey
Parameters:
blob - byte[]
start - int
len - int
Throws:
SshException

verifySignature

public boolean verifySignature(byte[] signature,
                               byte[] data)
                        throws SshException
Verify the signature.

Specified by:
verifySignature in interface SshPublicKey
Parameters:
signature - byte[]
data - byte[]
Returns:
true if the signature was produced by the corresponding private key that owns this public key, otherwise false.
Throws:
SshException

equals

public boolean equals(java.lang.Object obj)

hashCode

public int hashCode()

getG

public java.math.BigInteger getG()
Specified by:
getG in interface SshDsaPublicKey

getP

public java.math.BigInteger getP()
Specified by:
getP in interface SshDsaPublicKey

getQ

public java.math.BigInteger getQ()
Specified by:
getQ in interface SshDsaPublicKey

getY

public java.math.BigInteger getY()
Specified by:
getY in interface SshDsaPublicKey


Copyright © 2003-2008 SSHTools LTD. All Rights Reserved.