Class CipherFactory

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

public class CipherFactory extends Object
Factory methods for creating Cipher objects and CipherOutputStreams.
  • Constructor Details

    • CipherFactory

      public CipherFactory()
  • Method Details

    • createContentCipher

      public static Object createContentCipher(boolean forEncryption, CipherParameters encKey, AlgorithmIdentifier encryptionAlgID) throws 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:
      IllegalArgumentException
    • createOutputStream

      public static CipherOutputStream createOutputStream(OutputStream dOut, 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.