com.mindbright.security.publickey
Class BaseSignature

java.lang.Object
  extended by com.mindbright.jca.security.SignatureSpi
      extended by com.mindbright.security.publickey.BaseSignature
Direct Known Subclasses:
DSAWithSHA1, RawDSAWithSHA1, RSAWithAny

public abstract class BaseSignature
extends SignatureSpi


Field Summary
protected  MessageDigest digest
           
protected  PrivateKey privateKey
           
protected  PublicKey publicKey
           
 
Fields inherited from class com.mindbright.jca.security.SignatureSpi
appRandom
 
Constructor Summary
protected BaseSignature(java.lang.String digAlg)
           
 
Method Summary
 java.lang.Object clone()
           
protected  java.lang.Object engineGetParameter(java.lang.String param)
           
protected  void engineInitSign(PrivateKey privateKey)
           
protected  void engineInitSign(PrivateKey privateKey, SecureRandom random)
           
protected  void engineInitVerify(PublicKey publicKey)
           
protected  void engineSetParameter(AlgorithmParameterSpec params)
           
protected  void engineSetParameter(java.lang.String param, java.lang.Object value)
           
protected  byte[] engineSign()
           
protected  int engineSign(byte[] outbuf, int offset, int len)
           
protected  void engineUpdate(byte b)
           
protected  void engineUpdate(byte[] b, int off, int len)
           
protected  boolean engineVerify(byte[] sigBytes)
           
protected  SecureRandom getRandom()
           
protected abstract  void initSign()
           
protected abstract  void initVerify()
           
protected abstract  byte[] sign(byte[] data)
           
protected abstract  boolean verify(byte[] signature, byte[] data)
           
 
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

digest

protected MessageDigest digest

publicKey

protected PublicKey publicKey

privateKey

protected PrivateKey privateKey
Constructor Detail

BaseSignature

protected BaseSignature(java.lang.String digAlg)
Method Detail

engineInitVerify

protected final void engineInitVerify(PublicKey publicKey)
                               throws InvalidKeyException
Specified by:
engineInitVerify in class SignatureSpi
Throws:
InvalidKeyException

engineInitSign

protected final void engineInitSign(PrivateKey privateKey)
                             throws InvalidKeyException
Specified by:
engineInitSign in class SignatureSpi
Throws:
InvalidKeyException

engineInitSign

protected final void engineInitSign(PrivateKey privateKey,
                                    SecureRandom random)
                             throws InvalidKeyException
Specified by:
engineInitSign in class SignatureSpi
Throws:
InvalidKeyException

engineUpdate

protected void engineUpdate(byte b)
                     throws SignatureException
Specified by:
engineUpdate in class SignatureSpi
Throws:
SignatureException

engineUpdate

protected void engineUpdate(byte[] b,
                            int off,
                            int len)
                     throws SignatureException
Specified by:
engineUpdate in class SignatureSpi
Throws:
SignatureException

engineSign

protected byte[] engineSign()
                     throws SignatureException
Specified by:
engineSign in class SignatureSpi
Throws:
SignatureException

engineSign

protected int engineSign(byte[] outbuf,
                         int offset,
                         int len)
                  throws SignatureException
Overrides:
engineSign in class SignatureSpi
Throws:
SignatureException

engineVerify

protected boolean engineVerify(byte[] sigBytes)
                        throws SignatureException
Specified by:
engineVerify in class SignatureSpi
Throws:
SignatureException

engineSetParameter

protected void engineSetParameter(java.lang.String param,
                                  java.lang.Object value)
                           throws InvalidParameterException
Specified by:
engineSetParameter in class SignatureSpi
Throws:
InvalidParameterException

engineSetParameter

protected void engineSetParameter(AlgorithmParameterSpec params)
                           throws InvalidAlgorithmParameterException
Overrides:
engineSetParameter in class SignatureSpi
Throws:
InvalidAlgorithmParameterException

engineGetParameter

protected java.lang.Object engineGetParameter(java.lang.String param)
                                       throws InvalidParameterException
Specified by:
engineGetParameter in class SignatureSpi
Throws:
InvalidParameterException

clone

public java.lang.Object clone()
                       throws java.lang.CloneNotSupportedException
Overrides:
clone in class SignatureSpi
Throws:
java.lang.CloneNotSupportedException

getRandom

protected final SecureRandom getRandom()

initSign

protected abstract void initSign()
                          throws InvalidKeyException
Throws:
InvalidKeyException

initVerify

protected abstract void initVerify()
                            throws InvalidKeyException
Throws:
InvalidKeyException

sign

protected abstract byte[] sign(byte[] data)
                        throws SignatureException
Throws:
SignatureException

verify

protected abstract boolean verify(byte[] signature,
                                  byte[] data)
                           throws SignatureException
Throws:
SignatureException