com.mindbright.ssh2
Class SSH2DSS

java.lang.Object
  extended by com.mindbright.ssh2.SSH2Signature
      extended by com.mindbright.ssh2.SSH2SimpleSignature
          extended by com.mindbright.ssh2.SSH2DSS
All Implemented Interfaces:
SSH2PKISigner

public final class SSH2DSS
extends SSH2SimpleSignature

Implements "ssh-dss" signatures according to the ssh standard.


Field Summary
static java.lang.String SSH2_KEY_FORMAT
           
 
Fields inherited from class com.mindbright.ssh2.SSH2SimpleSignature
draftIncompatibleSignature, signatureAlgorithm, ssh2KeyFormat
 
Fields inherited from class com.mindbright.ssh2.SSH2Signature
algorithm, privateKey, pubKeyBlob, publicKey, signature
 
Constructor Summary
SSH2DSS()
          Constructor.
 
Method Summary
 PublicKey decodePublicKey(byte[] pubKeyBlob)
          Decode a public key blob.
 byte[] encodePublicKey(PublicKey publicKey)
          Encode the given public key into a public key blob.
 byte[] sign(byte[] data)
          Sign the given data.
 boolean verify(byte[] sigBlob, byte[] data)
          Verify that the given signature matches the given data and the public key.
 
Methods inherited from class com.mindbright.ssh2.SSH2SimpleSignature
decodeSignature, encodeSignature, getKeyFormat, getSignatureAlgorithm, getVerifyInstance, setIncompatibility
 
Methods inherited from class com.mindbright.ssh2.SSH2Signature
clearSensitiveData, getAlgorithmName, getEncodingInstance, getInstance, getPublicKey, getPublicKeyBlob, initSign, initVerify, initVerify, setPublicKey
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

SSH2_KEY_FORMAT

public static final java.lang.String SSH2_KEY_FORMAT
See Also:
Constant Field Values
Constructor Detail

SSH2DSS

public SSH2DSS()
Constructor.

Method Detail

encodePublicKey

public byte[] encodePublicKey(PublicKey publicKey)
                       throws SSH2Exception
Description copied from class: SSH2Signature
Encode the given public key into a public key blob.

Specified by:
encodePublicKey in class SSH2Signature
Parameters:
publicKey - The public key to encode. Must be an instance of DSAPublicKey.
Returns:
A byte array containing the key suitably encoded.
Throws:
SSH2Exception

decodePublicKey

public PublicKey decodePublicKey(byte[] pubKeyBlob)
                          throws SSH2Exception
Description copied from class: SSH2Signature
Decode a public key blob.

Specified by:
decodePublicKey in class SSH2Signature
Parameters:
pubKeyBlob - A byte array containing a public key blob.
Returns:
A Publickey instance.
Throws:
SSH2Exception

sign

public byte[] sign(byte[] data)
            throws SSH2SignatureException
Description copied from class: SSH2Signature
Sign the given data. The object must have been initialized for signing first.

Specified by:
sign in interface SSH2PKISigner
Overrides:
sign in class SSH2Signature
Parameters:
data - Data to sign.
Returns:
A signature blob encoded in the ssh format.
Throws:
SSH2SignatureException

verify

public boolean verify(byte[] sigBlob,
                      byte[] data)
               throws SSH2SignatureException
Description copied from class: SSH2Signature
Verify that the given signature matches the given data and the public key. The public key is given in the initialization call.

Overrides:
verify in class SSH2Signature
Parameters:
sigBlob - Signature blob encoded in the ssh format.
data - Signed data.
Returns:
True if the signature matches.
Throws:
SSH2SignatureException