BaseBlockCipher (Bouncy Castle Library 1.54 API Specification)
Date: 2015-12-29

org.bouncycastle.jcajce.provider.symmetric.util

## Class BaseBlockCipher

- java.lang.Object
- - javax.crypto.CipherSpi
  - - org.bouncycastle.jcajce.provider.symmetric.util.BaseWrapCipher
    - - org.bouncycastle.jcajce.provider.symmetric.util.BaseBlockCipher

- All Implemented Interfaces:
    PBE
  Direct Known Subclasses:
    AES.CBC, AES.CCM, AES.CFB, AES.ECB, AES.GCM, AES.OFB, AES.PBEWithAESCBC, AES.PBEWithSHA1AESCBC128, AES.PBEWithSHA1AESCBC192, AES.PBEWithSHA1AESCBC256, AES.PBEWithSHA256AESCBC128, AES.PBEWithSHA256AESCBC192, AES.PBEWithSHA256AESCBC256, Blowfish.CBC, Blowfish.ECB, Camellia.CBC, Camellia.ECB, CAST5.CBC, CAST5.ECB, CAST6.ECB, DES.CBC, DES.ECB, DES.PBEWithMD2, DES.PBEWithMD5, DES.PBEWithSHA1, DESede.CBC, DESede.ECB, DESede.PBEWithSHAAndDES2Key, DESede.PBEWithSHAAndDES3Key, GOST28147.CBC, GOST28147.ECB, GOST28147.GCFB, IDEA.CBC, IDEA.ECB, IDEA.PBEWithSHAAndIDEA, Noekeon.ECB, RC2.CBC, RC2.ECB, RC2.PBEWithMD5AndRC2, RC2.PBEWithSHA1AndRC2, RC2.PBEWithSHAAnd128BitRC2, RC2.PBEWithSHAAnd40BitRC2, RC5.CBC32, RC5.ECB32, RC5.ECB64, RC6.CBC, RC6.CFB, RC6.ECB, RC6.OFB, Rijndael.ECB, SEED.CBC, SEED.ECB, Serpent.CBC, Serpent.CFB, Serpent.ECB, Serpent.OFB, Serpent.TECB, Shacal2.CBC, Shacal2.ECB, Skipjack.ECB, SM4.ECB, TEA.ECB, Threefish.ECB_1024, Threefish.ECB_256, Threefish.ECB_512, Twofish.ECB, Twofish.PBEWithSHA, XTEA.ECB

      public class BaseBlockCipher
      extends BaseWrapCipher
      implements PBE

- - ### Nested Class Summary

    - ### Nested classes/interfaces inherited from interface org.bouncycastle.jcajce.provider.symmetric.util.PBE

      `PBE.Util`

  - ### Field Summary

    - ### Fields inherited from class org.bouncycastle.jcajce.provider.symmetric.util.BaseWrapCipher

      `engineParams, pbeHash, pbeIvSize, pbeKeySize, pbeType, wrapEngine`

    - ### Fields inherited from interface org.bouncycastle.jcajce.provider.symmetric.util.PBE

      `GOST3411, MD2, MD5, OPENSSL, PKCS12, PKCS5S1, PKCS5S1_UTF8, PKCS5S2, PKCS5S2_UTF8, RIPEMD160, SHA1, SHA256, TIGER`

  - ### Constructor Summary

    Constructors
    Modifier | Constructor and Description
    --- | ---
    `protected` | `BaseBlockCipher(AEADBlockCipher engine)`
    `protected` | `BaseBlockCipher(AEADBlockCipher engine, boolean fixedIv, int ivLength)`
    `protected` | `BaseBlockCipher(BlockCipher engine)`
    `protected` | `BaseBlockCipher(BlockCipher engine, int ivLength)`
    `protected` | `BaseBlockCipher(BlockCipher engine, int scheme, int digest, int keySizeInBits, int ivLength)`
    `protected` | `BaseBlockCipher(BlockCipherProvider provider)`
    `protected` | `BaseBlockCipher(BufferedBlockCipher engine, int ivLength)`

  - ### Method Summary

    Methods
    Modifier and Type | Method and Description
    --- | ---
    `protected byte[]` | `engineDoFinal(byte[] input, int inputOffset, int inputLen)`
    `protected int` | `engineDoFinal(byte[] input, int inputOffset, int inputLen, byte[] output, int outputOffset)`
    `protected int` | `engineGetBlockSize()`
    `protected byte[]` | `engineGetIV()`
    `protected int` | `engineGetKeySize(java.security.Key key)`
    `protected int` | `engineGetOutputSize(int inputLen)`
    `protected java.security.AlgorithmParameters` | `engineGetParameters()`
    `protected void` | `engineInit(int opmode, java.security.Key key, java.security.spec.AlgorithmParameterSpec params, java.security.SecureRandom random)`
    `protected void` | `engineInit(int opmode, java.security.Key key, java.security.AlgorithmParameters params, java.security.SecureRandom random)`
    `protected void` | `engineInit(int opmode, java.security.Key key, java.security.SecureRandom random)`
    `protected void` | `engineSetMode(java.lang.String mode)`
    `protected void` | `engineSetPadding(java.lang.String padding)`
    `protected byte[]` | `engineUpdate(byte[] input, int inputOffset, int inputLen)`
    `protected int` | `engineUpdate(byte[] input, int inputOffset, int inputLen, byte[] output, int outputOffset)`
    `protected void` | `engineUpdateAAD(byte[] input, int offset, int length)`
    `protected void` | `engineUpdateAAD(java.nio.ByteBuffer bytebuffer)`

    - ### Methods inherited from class org.bouncycastle.jcajce.provider.symmetric.util.BaseWrapCipher

      `createParametersInstance, engineUnwrap, engineWrap`

    - ### Methods inherited from class javax.crypto.CipherSpi

      `engineDoFinal, engineUpdate`

    - ### Methods inherited from class java.lang.Object

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- - ### Constructor Detail

    - #### BaseBlockCipher

          protected BaseBlockCipher(BlockCipher engine)

    - #### BaseBlockCipher

          protected BaseBlockCipher(BlockCipher engine,
                         int scheme,
                         int digest,
                         int keySizeInBits,
                         int ivLength)

    - #### BaseBlockCipher

          protected BaseBlockCipher(BlockCipherProvider provider)

    - #### BaseBlockCipher

          protected BaseBlockCipher(AEADBlockCipher engine)

    - #### BaseBlockCipher

          protected BaseBlockCipher(AEADBlockCipher engine,
                         boolean fixedIv,
                         int ivLength)

    - #### BaseBlockCipher

          protected BaseBlockCipher(BlockCipher engine,
                         int ivLength)

    - #### BaseBlockCipher

          protected BaseBlockCipher(BufferedBlockCipher engine,
                         int ivLength)

  - ### Method Detail

    - #### engineGetBlockSize

          protected int engineGetBlockSize()

      Overrides:
        `engineGetBlockSize` in class `BaseWrapCipher`

    - #### engineGetIV

          protected byte[] engineGetIV()

      Overrides:
        `engineGetIV` in class `BaseWrapCipher`

    - #### engineGetKeySize

          protected int engineGetKeySize(java.security.Key key)

      Overrides:
        `engineGetKeySize` in class `BaseWrapCipher`

    - #### engineGetOutputSize

          protected int engineGetOutputSize(int inputLen)

      Overrides:
        `engineGetOutputSize` in class `BaseWrapCipher`

    - #### engineGetParameters

          protected java.security.AlgorithmParameters engineGetParameters()

      Overrides:
        `engineGetParameters` in class `BaseWrapCipher`

    - #### engineSetMode

          protected void engineSetMode(java.lang.String mode)
                                throws java.security.NoSuchAlgorithmException

      Overrides:
        `engineSetMode` in class `BaseWrapCipher`
      Throws:
        `java.security.NoSuchAlgorithmException`

    - #### engineSetPadding

          protected void engineSetPadding(java.lang.String padding)
                                   throws javax.crypto.NoSuchPaddingException

      Overrides:
        `engineSetPadding` in class `BaseWrapCipher`
      Throws:
        `javax.crypto.NoSuchPaddingException`

    - #### engineInit

          protected void engineInit(int opmode,
                        java.security.Key key,
                        java.security.spec.AlgorithmParameterSpec params,
                        java.security.SecureRandom random)
                             throws java.security.InvalidKeyException,
                                    java.security.InvalidAlgorithmParameterException

      Overrides:
        `engineInit` in class `BaseWrapCipher`
      Throws:
        `java.security.InvalidKeyException`
        `java.security.InvalidAlgorithmParameterException`

    - #### engineInit

          protected void engineInit(int opmode,
                        java.security.Key key,
                        java.security.AlgorithmParameters params,
                        java.security.SecureRandom random)
                             throws java.security.InvalidKeyException,
                                    java.security.InvalidAlgorithmParameterException

      Overrides:
        `engineInit` in class `BaseWrapCipher`
      Throws:
        `java.security.InvalidKeyException`
        `java.security.InvalidAlgorithmParameterException`

    - #### engineInit

          protected void engineInit(int opmode,
                        java.security.Key key,
                        java.security.SecureRandom random)
                             throws java.security.InvalidKeyException

      Overrides:
        `engineInit` in class `BaseWrapCipher`
      Throws:
        `java.security.InvalidKeyException`

    - #### engineUpdateAAD

          protected void engineUpdateAAD(byte[] input,
                             int offset,
                             int length)

      Overrides:
        `engineUpdateAAD` in class `javax.crypto.CipherSpi`

    - #### engineUpdateAAD

          protected void engineUpdateAAD(java.nio.ByteBuffer bytebuffer)

      Overrides:
        `engineUpdateAAD` in class `javax.crypto.CipherSpi`

    - #### engineUpdate

          protected byte[] engineUpdate(byte[] input,
                            int inputOffset,
                            int inputLen)

      Overrides:
        `engineUpdate` in class `BaseWrapCipher`

    - #### engineUpdate

          protected int engineUpdate(byte[] input,
                         int inputOffset,
                         int inputLen,
                         byte[] output,
                         int outputOffset)
                              throws javax.crypto.ShortBufferException

      Overrides:
        `engineUpdate` in class `BaseWrapCipher`
      Throws:
        `javax.crypto.ShortBufferException`

    - #### engineDoFinal

          protected byte[] engineDoFinal(byte[] input,
                             int inputOffset,
                             int inputLen)
                                  throws javax.crypto.IllegalBlockSizeException,
                                         javax.crypto.BadPaddingException

      Overrides:
        `engineDoFinal` in class `BaseWrapCipher`
      Throws:
        `javax.crypto.IllegalBlockSizeException`
        `javax.crypto.BadPaddingException`

    - #### engineDoFinal

          protected int engineDoFinal(byte[] input,
                          int inputOffset,
                          int inputLen,
                          byte[] output,
                          int outputOffset)
                               throws javax.crypto.IllegalBlockSizeException,
                                      javax.crypto.BadPaddingException,
                                      javax.crypto.ShortBufferException

      Overrides:
        `engineDoFinal` in class `BaseWrapCipher`
      Throws:
        `javax.crypto.IllegalBlockSizeException`
        `javax.crypto.BadPaddingException`
        `javax.crypto.ShortBufferException`