org.mozilla.jss.pkcs11
Class PK11Signature

java.lang.Object
  |
  +--org.mozilla.jss.crypto.SignatureSpi
        |
        +--org.mozilla.jss.pkcs11.PK11Signature

final class PK11Signature
extends SignatureSpi


Field Summary
protected  Algorithm algorithm
           
protected  PK11Key key
           
protected  boolean raw
           
protected  java.io.ByteArrayOutputStream rawInput
           
protected  SigContextProxy sigContext
           
static int SIGN
           
protected  int state
           
protected  PK11Token token
           
protected  TokenProxy tokenProxy
           
static int UNINITIALIZED
           
static int VERIFY
           
 
Constructor Summary
PK11Signature(PK11Token token, SignatureAlgorithm algorithm)
           
 
Method Summary
 void engineInitSign(PrivateKey privateKey)
           
 void engineInitSign(PrivateKey privateKey, java.security.SecureRandom random)
          This is just here for JCA compliance, we don't take randoms this way.
 void engineInitVerify(java.security.PublicKey publicKey)
           
private static byte[] engineRawSignNative(PK11Token token, PrivateKey key, byte[] hash)
          Performs raw signing of the given hash with the given private key.
protected static boolean engineRawVerifyNative(PK11Token token, java.security.PublicKey key, byte[] hash, byte[] signature)
          Performs raw verification of the signature of a hash using the given public key, on the given token.
 void engineSetParameter(java.security.spec.AlgorithmParameterSpec params)
           
 byte[] engineSign()
           
 int engineSign(byte[] outbuf, int offset, int len)
           
private  byte[] engineSignNative()
           
 void engineUpdate(byte b)
           
 void engineUpdate(byte[] b, int off, int len)
           
protected  void engineUpdateNative(byte[] b, int off, int len)
           
 boolean engineVerify(byte[] sigBytes)
           
protected  boolean engineVerifyNative(byte[] sigBytes)
           
protected  void initSigContext()
          Creates a signing context, initializes it, and sets the sigContext field.
protected  void initVfyContext()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

token

protected PK11Token token

tokenProxy

protected TokenProxy tokenProxy

algorithm

protected Algorithm algorithm

key

protected PK11Key key

state

protected int state

sigContext

protected SigContextProxy sigContext

raw

protected boolean raw

rawInput

protected java.io.ByteArrayOutputStream rawInput

UNINITIALIZED

public static final int UNINITIALIZED
See Also:
Constant Field Values

SIGN

public static final int SIGN
See Also:
Constant Field Values

VERIFY

public static final int VERIFY
See Also:
Constant Field Values
Constructor Detail

PK11Signature

public PK11Signature(PK11Token token,
                     SignatureAlgorithm algorithm)
              throws java.security.NoSuchAlgorithmException,
                     TokenException
Method Detail

engineInitSign

public void engineInitSign(PrivateKey privateKey)
                    throws java.security.InvalidKeyException,
                           TokenException
Specified by:
engineInitSign in class SignatureSpi
java.security.InvalidKeyException
TokenException

engineInitSign

public void engineInitSign(PrivateKey privateKey,
                           java.security.SecureRandom random)
                    throws java.security.InvalidKeyException,
                           TokenException
This is just here for JCA compliance, we don't take randoms this way.

Specified by:
engineInitSign in class SignatureSpi
java.security.InvalidKeyException
TokenException

initSigContext

protected void initSigContext()
                       throws TokenException
Creates a signing context, initializes it, and sets the sigContext field.

TokenException

engineInitVerify

public void engineInitVerify(java.security.PublicKey publicKey)
                      throws java.security.InvalidKeyException,
                             TokenException
Specified by:
engineInitVerify in class SignatureSpi
java.security.InvalidKeyException
TokenException

initVfyContext

protected void initVfyContext()
                       throws TokenException
TokenException

engineUpdate

public void engineUpdate(byte b)
                  throws java.security.SignatureException,
                         TokenException
Specified by:
engineUpdate in class SignatureSpi
java.security.SignatureException
TokenException

engineUpdate

public void engineUpdate(byte[] b,
                         int off,
                         int len)
                  throws java.security.SignatureException,
                         TokenException
Specified by:
engineUpdate in class SignatureSpi
java.security.SignatureException
TokenException

engineUpdateNative

protected void engineUpdateNative(byte[] b,
                                  int off,
                                  int len)
                           throws TokenException
TokenException

engineSign

public byte[] engineSign()
                  throws java.security.SignatureException,
                         TokenException
Specified by:
engineSign in class SignatureSpi
java.security.SignatureException
TokenException

engineSign

public int engineSign(byte[] outbuf,
                      int offset,
                      int len)
               throws java.security.SignatureException,
                      TokenException
Specified by:
engineSign in class SignatureSpi
java.security.SignatureException
TokenException

engineRawSignNative

private static byte[] engineRawSignNative(PK11Token token,
                                          PrivateKey key,
                                          byte[] hash)
                                   throws java.security.SignatureException,
                                          TokenException
Performs raw signing of the given hash with the given private key.

java.security.SignatureException
TokenException

engineSignNative

private byte[] engineSignNative()
                         throws java.security.SignatureException,
                                TokenException
java.security.SignatureException
TokenException

engineVerify

public boolean engineVerify(byte[] sigBytes)
                     throws java.security.SignatureException,
                            TokenException
Specified by:
engineVerify in class SignatureSpi
java.security.SignatureException
TokenException

engineRawVerifyNative

protected static boolean engineRawVerifyNative(PK11Token token,
                                               java.security.PublicKey key,
                                               byte[] hash,
                                               byte[] signature)
                                        throws java.security.SignatureException,
                                               TokenException
Performs raw verification of the signature of a hash using the given public key, on the given token.

java.security.SignatureException
TokenException

engineVerifyNative

protected boolean engineVerifyNative(byte[] sigBytes)
                              throws java.security.SignatureException,
                                     TokenException
java.security.SignatureException
TokenException

engineSetParameter

public void engineSetParameter(java.security.spec.AlgorithmParameterSpec params)
                        throws java.security.InvalidAlgorithmParameterException,
                               TokenException
Specified by:
engineSetParameter in class SignatureSpi
java.security.InvalidAlgorithmParameterException
TokenException