de.flexiprovider.ec
Class ECNRSignature

java.lang.Object
  |
  +--java.security.SignatureSpi
        |
        +--de.flexiprovider.api.Signature
              |
              +--de.flexiprovider.ec.ECNRSignature

public class ECNRSignature
extends Signature

This Signature class is used to provide applications the functionality of the digital signature algorithm ECNR. Digital signatures are used for authentication and integrity assurance of digital data.

A Signature object can be used to generate and verify digital signatures. This specific signature ECNR is based on the discrete logarithm problem in a group of points of an elliptic curve over a primefield GF(q), where q is the prime and GF is a common synonym for a galois field. For a description of the signing and verifying procedure see the documentation of this package.

Author:
Birgit Henhapl, Oliver Seiler, Martin Döring
See Also:
ECPublicKey, ECPrivateKey, CurveParams

Fields inherited from class java.security.SignatureSpi
appRandom
 
Constructor Summary
ECNRSignature()
          Construct a blank ECNR object.
 
Method Summary
 void initSign(PrivateKey privateKey, SecureRandom random)
          Initializes this signature object with the specified private key and source of randomness for signing operations.
 void initVerify(PublicKey publicKey)
          Initializes this object for verification.
 void setParameters(AlgorithmParameterSpec params)
          Initialize the signature with the specified parameters.
 byte[] sign()
          Returns the signature bytes of all the data updated so far.
 void update(byte b)
          Updates the data to be signed or verified using the specified byte.
 void update(byte[] b, int off, int len)
          Updates the data to be signed or verified, using the specified array of bytes, starting at the specified offset.
 boolean verify(byte[] sigBytes)
          Verify the passed-in signature.
 
Methods inherited from class de.flexiprovider.api.Signature
engineGetParameter, engineInitSign, engineInitSign, engineInitVerify, engineSetParameter, engineSetParameter, engineSign, engineUpdate, engineUpdate, engineVerify, engineVerify, initSign, sign, update, verify, verify, verify
 
Methods inherited from class java.security.SignatureSpi
clone, engineSign
 
Methods inherited from class java.lang.Object
, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ECNRSignature

public ECNRSignature()
Construct a blank ECNR object. It must be initialized before being usable for signing or verifying.
Method Detail

initSign

public void initSign(PrivateKey privateKey,
                     SecureRandom random)
              throws InvalidKeyException
Initializes this signature object with the specified private key and source of randomness for signing operations.
Overrides:
initSign in class Signature
Parameters:
privateKey - the private key of the identity whose signature is going to be signed.
random - the source of randomness
Throws:
InvalidKeyException - If privateKey is an invalid key (invalid encoding, wrong length, uninitialized, etc).

initVerify

public void initVerify(PublicKey publicKey)
                throws InvalidKeyException
Initializes this object for verification. If this method is called again with a different argument, it negates the effect of this call.
Overrides:
initVerify in class Signature
Parameters:
publicKey - the public key of the identity whose signature is going to be verified.
Throws:
InvalidKeyException - If publicKey is an invalid key (invalid encoding, wrong length, uninitialized, etc).

setParameters

public void setParameters(AlgorithmParameterSpec params)
                   throws InvalidParameterException
Initialize the signature with the specified parameters. The parameters have to be an instance of (a subtype of) CurveParams.
Overrides:
setParameters in class Signature
Parameters:
params - the parameters
Throws:
InvalidParameterException - if the given parameters are not an instance of (a subtype of) CurveParams.

sign

public byte[] sign()
Returns the signature bytes of all the data updated so far.
Overrides:
sign in class Signature
Returns:
the signature bytes of the signing operation's result.

update

public void update(byte b)
Updates the data to be signed or verified using the specified byte.
Overrides:
update in class Signature
Parameters:
b - the byte to be updated.

update

public void update(byte[] b,
                   int off,
                   int len)
Updates the data to be signed or verified, using the specified array of bytes, starting at the specified offset.
Overrides:
update in class Signature
Parameters:
b - the array of bytes.
off - the offset to start from in the array of bytes.
len - the number of bytes to use, starting at offset.

verify

public boolean verify(byte[] sigBytes)
               throws SignatureException
Verify the passed-in signature.
Overrides:
verify in class Signature
Parameters:
sigBytes - the signature bytes to be verified
Returns:
true if the signature was verified, false if not.
Throws:
SignatureException - if this signature object is not initialized properly.