org.opensc.pkcs11.spi
Class PKCS11CipherSpi

java.lang.Object
  extended by javax.crypto.CipherSpi
      extended by org.opensc.pkcs11.spi.PKCS11CipherSpi

public class PKCS11CipherSpi
extends CipherSpi

This class is the implementation of the cryptographic Cipher service for the OpenSC PKCS#11 provider.

Author:
wglas

Constructor Summary
PKCS11CipherSpi(PKCS11Provider provider, String algorithm)
          Contructs an instance of PKCS11CipherSpi using the given provider and algorithm.
 
Method Summary
protected  byte[] engineDoFinal(byte[] input, int off, int len)
           
protected  int engineDoFinal(byte[] input, int off, int len, byte[] output, int output_off)
           
protected  int engineGetBlockSize()
           
protected  byte[] engineGetIV()
           
protected  int engineGetKeySize(Key key)
           
protected  int engineGetOutputSize(int sz)
           
protected  AlgorithmParameters engineGetParameters()
           
protected  void engineInit(int opmode, Key key, AlgorithmParameterSpec param, SecureRandom random)
           
protected  void engineInit(int opmode, Key key, AlgorithmParameters param, SecureRandom random)
           
protected  void engineInit(int opmode, Key key, SecureRandom random)
           
protected  void engineSetMode(String engineMode)
           
protected  void engineSetPadding(String padding)
           
protected  byte[] engineUpdate(byte[] data, int off, int len)
           
protected  int engineUpdate(byte[] input, int off, int len, byte[] output, int output_off)
           
 
Methods inherited from class javax.crypto.CipherSpi
engineDoFinal, engineUnwrap, engineUpdate, engineWrap
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

PKCS11CipherSpi

public PKCS11CipherSpi(PKCS11Provider provider,
                       String algorithm)
Contructs an instance of PKCS11CipherSpi using the given provider and algorithm. Usually, you will not have to call this contructor, This class is implicitly instantiated using Cipher.getInstance

See Also:
Cipher.getInstance(java.lang.String, java.security.Provider)
Method Detail

engineSetMode

protected void engineSetMode(String engineMode)
                      throws NoSuchAlgorithmException
Specified by:
engineSetMode in class CipherSpi
Throws:
NoSuchAlgorithmException

engineSetPadding

protected void engineSetPadding(String padding)
                         throws NoSuchPaddingException
Specified by:
engineSetPadding in class CipherSpi
Throws:
NoSuchPaddingException

engineGetKeySize

protected int engineGetKeySize(Key key)
                        throws InvalidKeyException
Overrides:
engineGetKeySize in class CipherSpi
Throws:
InvalidKeyException

engineGetBlockSize

protected int engineGetBlockSize()
Specified by:
engineGetBlockSize in class CipherSpi

engineGetOutputSize

protected int engineGetOutputSize(int sz)
Specified by:
engineGetOutputSize in class CipherSpi

engineGetIV

protected byte[] engineGetIV()
Specified by:
engineGetIV in class CipherSpi

engineGetParameters

protected AlgorithmParameters engineGetParameters()
Specified by:
engineGetParameters in class CipherSpi

engineInit

protected void engineInit(int opmode,
                          Key key,
                          SecureRandom random)
                   throws InvalidKeyException
Specified by:
engineInit in class CipherSpi
Throws:
InvalidKeyException

engineInit

protected void engineInit(int opmode,
                          Key key,
                          AlgorithmParameterSpec param,
                          SecureRandom random)
                   throws InvalidKeyException,
                          InvalidAlgorithmParameterException
Specified by:
engineInit in class CipherSpi
Throws:
InvalidKeyException
InvalidAlgorithmParameterException

engineInit

protected void engineInit(int opmode,
                          Key key,
                          AlgorithmParameters param,
                          SecureRandom random)
                   throws InvalidKeyException,
                          InvalidAlgorithmParameterException
Specified by:
engineInit in class CipherSpi
Throws:
InvalidKeyException
InvalidAlgorithmParameterException

engineUpdate

protected byte[] engineUpdate(byte[] data,
                              int off,
                              int len)
Specified by:
engineUpdate in class CipherSpi

engineUpdate

protected int engineUpdate(byte[] input,
                           int off,
                           int len,
                           byte[] output,
                           int output_off)
                    throws ShortBufferException
Specified by:
engineUpdate in class CipherSpi
Throws:
ShortBufferException

engineDoFinal

protected byte[] engineDoFinal(byte[] input,
                               int off,
                               int len)
                        throws IllegalBlockSizeException,
                               BadPaddingException
Specified by:
engineDoFinal in class CipherSpi
Throws:
IllegalBlockSizeException
BadPaddingException

engineDoFinal

protected int engineDoFinal(byte[] input,
                            int off,
                            int len,
                            byte[] output,
                            int output_off)
                     throws ShortBufferException,
                            IllegalBlockSizeException,
                            BadPaddingException
Specified by:
engineDoFinal in class CipherSpi
Throws:
ShortBufferException
IllegalBlockSizeException
BadPaddingException