|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectcom.mindbright.ssh2.SSH2Signature
Abstract base class for classes implementing the ssh2 signature algorithms.
| Field Summary | |
protected java.lang.String |
algorithm
|
protected PrivateKey |
privateKey
|
protected byte[] |
pubKeyBlob
|
protected PublicKey |
publicKey
|
protected Signature |
signature
|
| Constructor Summary | |
protected |
SSH2Signature()
Constructor. |
| Method Summary | |
void |
clearSensitiveData()
Try to remove any sensitive data from memory. |
protected abstract PublicKey |
decodePublicKey(byte[] pubKeyBlob)
Decode a public key blob. |
protected abstract byte[] |
decodeSignature(byte[] sigBlob)
Decode the given signature blob from the ssh standard form to the internal form. |
protected abstract byte[] |
encodePublicKey(PublicKey publicKey)
Encode the given public key into a public key blob. |
protected abstract byte[] |
encodeSignature(byte[] sigRaw)
Encode the given, internal form, signature into the ssh standard form. |
java.lang.String |
getAlgorithmName()
Get the algorithm this instance handles. |
static SSH2Signature |
getEncodingInstance(java.lang.String algorithm)
Get a SSH2Signature instance suitable for encoding
with the given algorithm. |
static SSH2Signature |
getInstance(java.lang.String algorithm)
Get a SSH2Signature instance suitable for encoding
with the given algorithm. |
PublicKey |
getPublicKey()
Get the public key associated with this SSH2Signature object. |
byte[] |
getPublicKeyBlob()
Get the public key associated with this SSH2Signature object. |
protected abstract java.lang.String |
getSignatureAlgorithm()
Get the signature algorithm. |
void |
initSign(PrivateKey privateKey)
Prepare for signing with the given private key. |
void |
initVerify(byte[] pubKeyBlob)
Prepare to verify a signature with the given public key. |
void |
initVerify(PublicKey publicKey)
Prepare to verify a signature with the given public key. |
void |
setIncompatibility(SSH2Transport transport)
Set eventual incompatibility modes depending on the remote end. |
void |
setPublicKey(PublicKey publicKey)
Associate a public key with this object. |
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 |
| Field Detail |
protected java.lang.String algorithm
protected Signature signature
protected PrivateKey privateKey
protected PublicKey publicKey
protected byte[] pubKeyBlob
| Constructor Detail |
protected SSH2Signature()
| Method Detail |
public static SSH2Signature getInstance(java.lang.String algorithm)
throws SSH2Exception
SSH2Signature instance suitable for encoding
with the given algorithm.
algorithm - The algorithm. Currently the valid values are
"ssh-dss" and "ssh-rsa".
SSH2Exception
public static SSH2Signature getEncodingInstance(java.lang.String algorithm)
throws SSH2Exception
SSH2Signature instance suitable for encoding
with the given algorithm.
algorithm - The algorithm. Currently the valid values are
"ssh-dss" and "ssh-rsa".
SSH2Exceptionpublic final java.lang.String getAlgorithmName()
getAlgorithmName in interface SSH2PKISigner
public final byte[] getPublicKeyBlob()
throws SSH2SignatureException
SSH2Signature object.
getPublicKeyBlob in interface SSH2PKISignerSSH2SignatureException
public final PublicKey getPublicKey()
throws SSH2SignatureException
SSH2Signature object.
SSH2SignatureExceptionpublic final void setPublicKey(PublicKey publicKey)
publicKey - The key to associate.public void setIncompatibility(SSH2Transport transport)
SSH2PKISigner
setIncompatibility in interface SSH2PKISignertransport - An SSH2Transport object which identifies the
other end.
public final void initSign(PrivateKey privateKey)
throws SSH2Exception
privateKey - Key to use for signing.
SSH2Exception
public final void initVerify(PublicKey publicKey)
throws SSH2Exception
publicKey - Key to use when verifying.
SSH2Exception
public final void initVerify(byte[] pubKeyBlob)
throws SSH2Exception
pubKeyBlob - key to use when verifying, encoded as a public
key blob.
SSH2Exception
public final byte[] sign(byte[] data)
throws SSH2SignatureException
sign in interface SSH2PKISignerdata - Data to sign.
SSH2SignatureException
public final boolean verify(byte[] sigBlob,
byte[] data)
throws SSH2SignatureException
sigBlob - Signature blob encoded in the ssh format.data - Signed data.
SSH2SignatureExceptionprotected abstract java.lang.String getSignatureAlgorithm()
protected abstract byte[] encodePublicKey(PublicKey publicKey)
throws SSH2Exception
publicKey - The public key to encode. Must be an instance of
DSAPublicKey.
SSH2Exception
protected abstract PublicKey decodePublicKey(byte[] pubKeyBlob)
throws SSH2Exception
pubKeyBlob - A byte array containing a public key blob.
Publickey instance.
SSH2Exceptionprotected abstract byte[] encodeSignature(byte[] sigRaw)
sigRaw - The raw signature.
protected abstract byte[] decodeSignature(byte[] sigBlob)
throws SSH2SignatureException
sigBlob - The encoded signature.
SSH2SignatureExceptionpublic void clearSensitiveData()
SSH2PKISigner
clearSensitiveData in interface SSH2PKISigner
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||