org.mozilla.jss.provider.javax.crypto
Class JSSCipherSpi

java.lang.Object
  |
  +--javax.crypto.CipherSpi
        |
        +--org.mozilla.jss.provider.javax.crypto.JSSCipherSpi
Direct Known Subclasses:
JSSCipherSpi.AES, JSSCipherSpi.DES, JSSCipherSpi.DESede, JSSCipherSpi.RC4

class JSSCipherSpi
extends javax.crypto.CipherSpi


Nested Class Summary
static class JSSCipherSpi.AES
           
static class JSSCipherSpi.DES
           
static class JSSCipherSpi.DESede
           
private static class JSSCipherSpi.NoAlgParams
           
static class JSSCipherSpi.RC4
           
 
Field Summary
private  java.lang.String algFamily
           
private  java.lang.String algMode
           
private  java.lang.String algPadding
           
private  int blockSize
           
private  Cipher cipher
           
private  EncryptionAlgorithm encAlg
           
private static JSSCipherSpi.NoAlgParams noAlgParams
           
private  java.security.spec.AlgorithmParameterSpec params
           
(package private)  CryptoToken token
           
private  KeyWrapAlgorithm wrapAlg
           
private  KeyWrapper wrapper
           
 
Constructor Summary
private JSSCipherSpi()
           
protected JSSCipherSpi(java.lang.String algFamily)
           
 
Method Summary
 byte[] engineDoFinal(byte[] input, int inputOffset, int inputLen)
           
 int engineDoFinal(byte[] input, int inputOffset, int inputLen, byte[] output, int outputOffset)
           
 int engineGetBlockSize()
           
 byte[] engineGetIV()
           
 int engineGetKeySize(java.security.Key key)
           
 int engineGetOutputSize(int inputLen)
           
 java.security.AlgorithmParameters engineGetParameters()
           
 void engineInit(int opmode, java.security.Key key, java.security.spec.AlgorithmParameterSpec givenParams, java.security.SecureRandom random)
           
 void engineInit(int opmode, java.security.Key key, java.security.AlgorithmParameters givenParams, java.security.SecureRandom random)
           
 void engineInit(int opmode, java.security.Key key, java.security.SecureRandom random)
           
 void engineSetMode(java.lang.String mode)
           
 void engineSetPadding(java.lang.String padding)
           
 java.security.Key engineUnwrap(byte[] wrappedKey, java.lang.String wrappedKeyAlgorithm, int wrappedKeyType)
           
private  java.security.Key engineUnwrapPrivate(byte[] wrappedKey, java.lang.String wrappedKeyAlg)
           
private  java.security.Key engineUnwrapSecret(byte[] wrappedKey, java.lang.String wrappedKeyAlg)
           
 byte[] engineUpdate(byte[] input, int inputOffset, int inputLen)
           
 int engineUpdate(byte[] input, int inputOffset, int inputLen, byte[] output, int outputOffset)
           
 byte[] engineWrap(java.security.Key key)
           
private static java.security.spec.AlgorithmParameterSpec generateAlgParams(Algorithm alg, int blockSize)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

algFamily

private java.lang.String algFamily

algMode

private java.lang.String algMode

algPadding

private java.lang.String algPadding

token

CryptoToken token

cipher

private Cipher cipher

encAlg

private EncryptionAlgorithm encAlg

wrapper

private KeyWrapper wrapper

wrapAlg

private KeyWrapAlgorithm wrapAlg

params

private java.security.spec.AlgorithmParameterSpec params

blockSize

private int blockSize

noAlgParams

private static final JSSCipherSpi.NoAlgParams noAlgParams
Constructor Detail

JSSCipherSpi

private JSSCipherSpi()

JSSCipherSpi

protected JSSCipherSpi(java.lang.String algFamily)
Method Detail

engineSetMode

public void engineSetMode(java.lang.String mode)
Specified by:
engineSetMode in class javax.crypto.CipherSpi

engineSetPadding

public void engineSetPadding(java.lang.String padding)
Specified by:
engineSetPadding in class javax.crypto.CipherSpi

engineInit

public void engineInit(int opmode,
                       java.security.Key key,
                       java.security.spec.AlgorithmParameterSpec givenParams,
                       java.security.SecureRandom random)
                throws java.security.InvalidKeyException,
                       java.security.InvalidAlgorithmParameterException
Specified by:
engineInit in class javax.crypto.CipherSpi
java.security.InvalidKeyException
java.security.InvalidAlgorithmParameterException

engineInit

public void engineInit(int opmode,
                       java.security.Key key,
                       java.security.AlgorithmParameters givenParams,
                       java.security.SecureRandom random)
                throws java.security.InvalidKeyException,
                       java.security.InvalidAlgorithmParameterException
Specified by:
engineInit in class javax.crypto.CipherSpi
java.security.InvalidKeyException
java.security.InvalidAlgorithmParameterException

engineInit

public void engineInit(int opmode,
                       java.security.Key key,
                       java.security.SecureRandom random)
                throws java.security.InvalidKeyException
Specified by:
engineInit in class javax.crypto.CipherSpi
java.security.InvalidKeyException

generateAlgParams

private static java.security.spec.AlgorithmParameterSpec generateAlgParams(Algorithm alg,
                                                                           int blockSize)
                                                                    throws java.security.InvalidKeyException
java.security.InvalidKeyException

engineGetBlockSize

public int engineGetBlockSize()
Specified by:
engineGetBlockSize in class javax.crypto.CipherSpi

engineGetIV

public byte[] engineGetIV()
Specified by:
engineGetIV in class javax.crypto.CipherSpi

engineGetParameters

public java.security.AlgorithmParameters engineGetParameters()
Specified by:
engineGetParameters in class javax.crypto.CipherSpi

engineGetOutputSize

public int engineGetOutputSize(int inputLen)
Specified by:
engineGetOutputSize in class javax.crypto.CipherSpi

engineUpdate

public byte[] engineUpdate(byte[] input,
                           int inputOffset,
                           int inputLen)
Specified by:
engineUpdate in class javax.crypto.CipherSpi

engineUpdate

public int engineUpdate(byte[] input,
                        int inputOffset,
                        int inputLen,
                        byte[] output,
                        int outputOffset)
                 throws javax.crypto.ShortBufferException
Specified by:
engineUpdate in class javax.crypto.CipherSpi
javax.crypto.ShortBufferException

engineDoFinal

public byte[] engineDoFinal(byte[] input,
                            int inputOffset,
                            int inputLen)
                     throws javax.crypto.IllegalBlockSizeException,
                            javax.crypto.BadPaddingException
Specified by:
engineDoFinal in class javax.crypto.CipherSpi
javax.crypto.IllegalBlockSizeException
javax.crypto.BadPaddingException

engineDoFinal

public int engineDoFinal(byte[] input,
                         int inputOffset,
                         int inputLen,
                         byte[] output,
                         int outputOffset)
                  throws javax.crypto.ShortBufferException,
                         javax.crypto.IllegalBlockSizeException,
                         javax.crypto.BadPaddingException
Specified by:
engineDoFinal in class javax.crypto.CipherSpi
javax.crypto.ShortBufferException
javax.crypto.IllegalBlockSizeException
javax.crypto.BadPaddingException

engineWrap

public byte[] engineWrap(java.security.Key key)
                  throws javax.crypto.IllegalBlockSizeException,
                         java.security.InvalidKeyException
Overrides:
engineWrap in class javax.crypto.CipherSpi
javax.crypto.IllegalBlockSizeException
java.security.InvalidKeyException

engineUnwrap

public java.security.Key engineUnwrap(byte[] wrappedKey,
                                      java.lang.String wrappedKeyAlgorithm,
                                      int wrappedKeyType)
                               throws java.security.InvalidKeyException,
                                      java.security.NoSuchAlgorithmException
Overrides:
engineUnwrap in class javax.crypto.CipherSpi
java.security.InvalidKeyException
java.security.NoSuchAlgorithmException

engineUnwrapSecret

private java.security.Key engineUnwrapSecret(byte[] wrappedKey,
                                             java.lang.String wrappedKeyAlg)
                                      throws java.security.InvalidKeyException,
                                             java.security.NoSuchAlgorithmException
java.security.InvalidKeyException
java.security.NoSuchAlgorithmException

engineUnwrapPrivate

private java.security.Key engineUnwrapPrivate(byte[] wrappedKey,
                                              java.lang.String wrappedKeyAlg)
                                       throws java.security.InvalidKeyException,
                                              java.security.NoSuchAlgorithmException
java.security.InvalidKeyException
java.security.NoSuchAlgorithmException

engineGetKeySize

public int engineGetKeySize(java.security.Key key)
                     throws java.security.InvalidKeyException
Overrides:
engineGetKeySize in class javax.crypto.CipherSpi
java.security.InvalidKeyException