com.mindbright.ssh2
Class SSH2ECDSASHA2NIST

java.lang.Object
  extended by com.mindbright.ssh2.SSH2Signature
      extended by com.mindbright.ssh2.SSH2SimpleSignature
          extended by com.mindbright.ssh2.SSH2ECDSASHA2NIST
All Implemented Interfaces:
SSH2PKISigner
Direct Known Subclasses:
SSH2ECDSASHA2NIST.P256, SSH2ECDSASHA2NIST.P384, SSH2ECDSASHA2NIST.P521

public abstract class SSH2ECDSASHA2NIST
extends SSH2SimpleSignature


Nested Class Summary
static class SSH2ECDSASHA2NIST.P256
           
static class SSH2ECDSASHA2NIST.P384
           
static class SSH2ECDSASHA2NIST.P521
           
 
Field Summary
 
Fields inherited from class com.mindbright.ssh2.SSH2SimpleSignature
draftIncompatibleSignature, signatureAlgorithm, ssh2KeyFormat
 
Fields inherited from class com.mindbright.ssh2.SSH2Signature
algorithm, pubKeyBlob, publicKey, signature
 
Constructor Summary
SSH2ECDSASHA2NIST(java.lang.String algo, java.lang.String sshname, java.lang.String curve)
           
 
Method Summary
protected  java.security.PublicKey decodePublicKey(byte[] pubKeyBlob)
          Decode a public key blob.
protected  byte[] encodePublicKey(java.security.PublicKey publicKey)
          Encode the given public key into a public key blob.
static java.security.spec.ECParameterSpec getParamsForCurve(java.lang.String curve)
           
 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
 

Constructor Detail

SSH2ECDSASHA2NIST

public SSH2ECDSASHA2NIST(java.lang.String algo,
                         java.lang.String sshname,
                         java.lang.String curve)
Method Detail

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

encodePublicKey

protected 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

getParamsForCurve

public static java.security.spec.ECParameterSpec getParamsForCurve(java.lang.String curve)

decodePublicKey

protected 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