com.maverick.ssh.components.jce
Class Ssh2RsaPublicKey

java.lang.Object
  extended bycom.maverick.ssh.components.jce.Ssh2RsaPublicKey
All Implemented Interfaces:
SshPublicKey, SshRsaPublicKey
Direct Known Subclasses:
Ssh1RsaPublicKey, SshX509RsaPublicKey

public class Ssh2RsaPublicKey
extends java.lang.Object
implements SshRsaPublicKey

A RSA public key implementation which uses a JCE provider.

Author:
Lee David Painter

Constructor Summary
Ssh2RsaPublicKey()
          Default constructor for initializing the key from a byte array using the init method.
Ssh2RsaPublicKey(java.math.BigInteger modulus, java.math.BigInteger publicExponent)
           
Ssh2RsaPublicKey(java.security.interfaces.RSAPublicKey pubKey)
           
 
Method Summary
 java.math.BigInteger doPublic(java.math.BigInteger input)
           
 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 getModulus()
           
 java.math.BigInteger getPublicExponent()
           
 int getVersion()
           
 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
 

Constructor Detail

Ssh2RsaPublicKey

public Ssh2RsaPublicKey()
Default constructor for initializing the key from a byte array using the init method.


Ssh2RsaPublicKey

public Ssh2RsaPublicKey(java.security.interfaces.RSAPublicKey pubKey)

Ssh2RsaPublicKey

public Ssh2RsaPublicKey(java.math.BigInteger modulus,
                        java.math.BigInteger publicExponent)
                 throws java.security.NoSuchAlgorithmException,
                        java.security.spec.InvalidKeySpecException
Method Detail

getEncoded

public byte[] getEncoded()
                  throws SshException
Description copied from interface: SshPublicKey
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:
String
Throws:
SshException

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

init

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

Specified by:
init in interface SshPublicKey
Parameters:
blob -
start -
len -
Throws:
SshException

getAlgorithm

public java.lang.String getAlgorithm()
Description copied from interface: SshPublicKey
Get the algorithm name for the public key.

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

verifySignature

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

Specified by:
verifySignature in interface SshPublicKey
Parameters:
signature -
data -
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()

doPublic

public java.math.BigInteger doPublic(java.math.BigInteger input)
                              throws SshException
Specified by:
doPublic in interface SshRsaPublicKey
Throws:
SshException

getModulus

public java.math.BigInteger getModulus()
Specified by:
getModulus in interface SshRsaPublicKey

getPublicExponent

public java.math.BigInteger getPublicExponent()
Specified by:
getPublicExponent in interface SshRsaPublicKey

getVersion

public int getVersion()
Specified by:
getVersion in interface SshRsaPublicKey


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