org.bouncycastle.crypto.util

## Class CipherFactory

- java.lang.Object
- - org.bouncycastle.crypto.util.CipherFactory

-     public class CipherFactory
      extends java.lang.Object

  Factory methods for creating Cipher objects and CipherOutputStreams.

- - ### Constructor Summary

    Constructors
    Constructor and Description
    `CipherFactory()`

  - ### Method Summary

    All Methods Static Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `static java.lang.Object` | `createContentCipher(boolean forEncryption, CipherParameters encKey, AlgorithmIdentifier encryptionAlgID)` Create a content cipher for encrypting bulk data.
    `static CipherOutputStream` | `createOutputStream(java.io.OutputStream dOut, java.lang.Object cipher)` Return a new CipherOutputStream based on the passed in cipher.

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

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

- - ### Constructor Detail

    - #### CipherFactory

          public CipherFactory()

  - ### Method Detail

    - #### createContentCipher

          public static java.lang.Object createContentCipher(boolean forEncryption,
                                                             CipherParameters encKey,
                                                             AlgorithmIdentifier encryptionAlgID)
                                                      throws java.lang.IllegalArgumentException

      Create a content cipher for encrypting bulk data.
      Parameters:
        `forEncryption` - true if the cipher is for encryption, false otherwise.
        `encKey` - the basic key to use.
        `encryptionAlgID` - identifying algorithm OID and parameters to use.
      Returns:
        a StreamCipher or a BufferedBlockCipher depending on the algorithm.
      Throws:
        `java.lang.IllegalArgumentException`

    - #### createOutputStream

          public static CipherOutputStream createOutputStream(java.io.OutputStream dOut,
                                                              java.lang.Object cipher)

      Return a new CipherOutputStream based on the passed in cipher.
      Parameters:
        `dOut` - the output stream to write the processed data to.
        `cipher` - the cipher to use.
      Returns:
        a BC CipherOutputStream using the cipher and writing to dOut.