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

org.bouncycastle.crypto.engines

## Class CramerShoupCoreEngine

- java.lang.Object
- - org.bouncycastle.crypto.engines.CramerShoupCoreEngine

-     public class CramerShoupCoreEngine
      extends java.lang.Object

  Essentially the Cramer-Shoup encryption / decryption algorithms according to "A practical public key cryptosystem provably secure against adaptive chosen ciphertext attack." (Crypto 1998)

- - ### Nested Class Summary

    Nested Classes
    Modifier and Type | Class and Description
    --- | ---
    `static class` | `CramerShoupCoreEngine.CramerShoupCiphertextException` CS exception for wrong cipher-texts

  - ### Constructor Summary

    Constructors
    Constructor and Description
    `CramerShoupCoreEngine()`

  - ### Method Summary

    Methods
    Modifier and Type | Method and Description
    --- | ---
    `java.math.BigInteger` | `convertInput(byte[] in, int inOff, int inLen)`
    `byte[]` | `convertOutput(java.math.BigInteger result)`
    `java.math.BigInteger` | `decryptBlock(CramerShoupCiphertext input)`
    `CramerShoupCiphertext` | `encryptBlock(java.math.BigInteger input)`
    `int` | `getInputBlockSize()` Return the maximum size for an input block to this engine.
    `int` | `getOutputBlockSize()` Return the maximum size for an output block to this engine.
    `void` | `init(boolean forEncryption, CipherParameters param)` initialise the CramerShoup engine.
    `void` | `init(boolean forEncryption, CipherParameters param, java.lang.String label)` initialise the CramerShoup engine.
    `protected java.security.SecureRandom` | `initSecureRandom(boolean needed, java.security.SecureRandom provided)`

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

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

- - ### Constructor Detail

    - #### CramerShoupCoreEngine

          public CramerShoupCoreEngine()

  - ### Method Detail

    - #### init

          public void init(boolean forEncryption,
                  CipherParameters param,
                  java.lang.String label)

      initialise the CramerShoup engine.
      Parameters:
        `forEncryption` - whether this engine should encrypt or decrypt
        `param` - the necessary CramerShoup key parameters.
        `label` - the label for labelled CS as `String`

    - #### init

          public void init(boolean forEncryption,
                  CipherParameters param)

      initialise the CramerShoup engine.
      Parameters:
        `forEncryption` - whether this engine should encrypt or decrypt
        `param` - the necessary CramerShoup key parameters.

    - #### getInputBlockSize

          public int getInputBlockSize()

      Return the maximum size for an input block to this engine. For Cramer Shoup this is always one byte less than the key size on encryption, and the same length as the key size on decryption. TODO: correct?
      Returns:
        maximum size for an input block.

    - #### getOutputBlockSize

          public int getOutputBlockSize()

      Return the maximum size for an output block to this engine. For Cramer Shoup this is always one byte less than the key size on decryption, and the same length as the key size on encryption. TODO: correct?
      Returns:
        maximum size for an output block.

    - #### convertInput

          public java.math.BigInteger convertInput(byte[] in,
                                          int inOff,
                                          int inLen)

    - #### convertOutput

          public byte[] convertOutput(java.math.BigInteger result)

    - #### encryptBlock

          public CramerShoupCiphertext encryptBlock(java.math.BigInteger input)

    - #### decryptBlock

          public java.math.BigInteger decryptBlock(CramerShoupCiphertext input)
                                            throws CramerShoupCoreEngine.CramerShoupCiphertextException

      Throws:
        `CramerShoupCoreEngine.CramerShoupCiphertextException`

    - #### initSecureRandom

          protected java.security.SecureRandom initSecureRandom(boolean needed,
                                                    java.security.SecureRandom provided)