com.mindbright.ssh2
Class SSH2DSS
java.lang.Object
com.mindbright.ssh2.SSH2Signature
com.mindbright.ssh2.SSH2SimpleSignature
com.mindbright.ssh2.SSH2DSS
- All Implemented Interfaces:
- SSH2PKISigner
public final class SSH2DSS
- extends SSH2SimpleSignature
Implements "ssh-dss" signatures according to the ssh standard.
Constructor Summary |
SSH2DSS()
Constructor. |
Method Summary |
java.security.PublicKey |
decodePublicKey(byte[] pubKeyBlob)
Decode a public key blob. |
byte[] |
encodePublicKey(java.security.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 java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
SSH2_KEY_FORMAT
public static final java.lang.String SSH2_KEY_FORMAT
- See Also:
- Constant Field Values
SSH2DSS
public SSH2DSS()
- Constructor.
encodePublicKey
public byte[] encodePublicKey(java.security.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 java.security.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