Top Description Fields Constructors Methods
org.bouncycastle.crypto.util

public Class CipherFactory

extends Object
Class Inheritance
Imports
java.io.OutputStream, org.bouncycastle.asn1.ASN1Integer, .ASN1Null, .ASN1ObjectIdentifier, .ASN1OctetString, .ASN1Primitive, org.bouncycastle.asn1.nist.NISTObjectIdentifiers, org.bouncycastle.asn1.pkcs.PKCSObjectIdentifiers, .RC2CBCParameter, org.bouncycastle.asn1.x509.AlgorithmIdentifier, org.bouncycastle.crypto.BlockCipher, .BufferedBlockCipher, .CipherParameters, .StreamCipher, org.bouncycastle.crypto.engines.AESEngine, .CAST5Engine, .DESEngine, .DESedeEngine, .RC2Engine, .RC4Engine, org.bouncycastle.crypto.io.CipherOutputStream, org.bouncycastle.crypto.modes.AEADBlockCipher, .CBCBlockCipher, .CCMBlockCipher, .GCMBlockCipher, org.bouncycastle.crypto.paddings.PKCS7Padding, .PaddedBufferedBlockCipher, org.bouncycastle.crypto.params.AEADParameters, .KeyParameter, .ParametersWithIV, .RC2Parameters, org.bouncycastle.internal.asn1.cms.CCMParameters, .GCMParameters, org.bouncycastle.internal.asn1.kisa.KISAObjectIdentifiers, org.bouncycastle.internal.asn1.misc.CAST5CBCParameters, .MiscObjectIdentifiers, org.bouncycastle.internal.asn1.ntt.NTTObjectIdentifiers, org.bouncycastle.internal.asn1.oiw.OIWObjectIdentifiers

Factory methods for creating Cipher objects and CipherOutputStreams.

Field Summary

Modifier and TypeField and Description
private static final short[]

Constructor Summary

AccessConstructor and Description
public

Method Summary

Modifier and TypeMethod and Description
private static AEADBlockCipher
private static BufferedBlockCipher
public static Object

Returns:

a StreamCipher or a BufferedBlockCipher depending on the algorithm.
createContentCipher
(boolean
true if the cipher is for encryption, false otherwise.
forEncryption
,
CipherParameters
the basic key to use.
encKey
,
AlgorithmIdentifier
identifying algorithm OID and parameters to use.
encryptionAlgID
)

Create a content cipher for encrypting bulk data.

public static CipherOutputStream

Returns:

a BC CipherOutputStream using the cipher and writing to dOut.
createOutputStream
(OutputStream
the output stream to write the processed data to.
dOut
,
Object
the cipher to use.
cipher
)

Return a new CipherOutputStream based on the passed in cipher.

private static int
Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

rc2Ekbback to summary
private static final short[] rc2Ekb

Constructor Detail

CipherFactoryback to summary
public CipherFactory()

Method Detail

createAEADCipherback to summary
private static AEADBlockCipher createAEADCipher(ASN1ObjectIdentifier algorithm)
createCipherback to summary
private static BufferedBlockCipher createCipher(ASN1ObjectIdentifier algorithm) throws IllegalArgumentException
createContentCipherback to summary
public static Object createContentCipher(boolean forEncryption, CipherParameters encKey, AlgorithmIdentifier encryptionAlgID) throws IllegalArgumentException

Create a content cipher for encrypting bulk data.

Parameters
forEncryption:boolean

true if the cipher is for encryption, false otherwise.

encKey:CipherParameters

the basic key to use.

encryptionAlgID:AlgorithmIdentifier

identifying algorithm OID and parameters to use.

Returns:Object

a StreamCipher or a BufferedBlockCipher depending on the algorithm.

createOutputStreamback to summary
public static CipherOutputStream createOutputStream(OutputStream dOut, Object cipher)

Return a new CipherOutputStream based on the passed in cipher.

Parameters
dOut:OutputStream

the output stream to write the processed data to.

cipher:Object

the cipher to use.

Returns:CipherOutputStream

a BC CipherOutputStream using the cipher and writing to dOut.

getRC2EffectiveKeyBitsback to summary
private static int getRC2EffectiveKeyBits(RC2CBCParameter rc2CbcParameter)