Package org.bouncycastle.crypto.util
Class CipherFactory
java.lang.Object
org.bouncycastle.crypto.util.CipherFactory
Factory methods for creating Cipher objects and CipherOutputStreams.
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionstatic Object
createContentCipher
(boolean forEncryption, CipherParameters encKey, AlgorithmIdentifier encryptionAlgID) Create a content cipher for encrypting bulk data.static CipherOutputStream
createOutputStream
(OutputStream dOut, Object cipher) Return a new CipherOutputStream based on the passed in cipher.
-
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
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.
-