Top Description Inners Fields Constructors Methods
org.bouncycastle.cms.jcajce

public Class JceCMSContentEncryptorBuilder

extends Object
Class Inheritance
Imports
java.io.OutputStream, java.security.AccessController, .AlgorithmParameters, .GeneralSecurityException, .PrivilegedAction, .Provider, .SecureRandom, javax.crypto.Cipher, .KeyGenerator, .SecretKey, org.bouncycastle.asn1.ASN1Encodable, .ASN1ObjectIdentifier, .DERNull, org.bouncycastle.asn1.cms.GCMParameters, org.bouncycastle.asn1.oiw.OIWObjectIdentifiers, org.bouncycastle.asn1.pkcs.PKCSObjectIdentifiers, org.bouncycastle.asn1.x509.AlgorithmIdentifier, org.bouncycastle.cms.CMSException, org.bouncycastle.crypto.CryptoServicesRegistrar, org.bouncycastle.jcajce.io.CipherOutputStream, org.bouncycastle.operator.DefaultSecretKeySizeProvider, .GenericKey, .MacCaptureStream, .OutputAEADEncryptor, .OutputEncryptor, .SecretKeySizeProvider, org.bouncycastle.operator.jcajce.JceGenericKey

Builder for the content encryptor in EnvelopedData - used to encrypt the actual transmitted content.

Nested and Inner Type Summary

Modifier and TypeClass and Description
private class
private class

Field Summary

Modifier and TypeField and Description
private AlgorithmIdentifier
private AlgorithmParameters
private final ASN1ObjectIdentifier
private EnvelopedDataHelper
private static final SecretKeySizeProvider
private final int
private SecureRandom

Constructor Summary

AccessConstructor and Description
public
public
public
JceCMSContentEncryptorBuilder(AlgorithmIdentifier
the full algorithm identifier for the encryption.
encryptionAlgId
)

Constructor for a content encryptor builder based on an algorithm identifier and its contained parameters.

Method Summary

Modifier and TypeMethod and Description
public OutputEncryptor
private static boolean
public JceCMSContentEncryptorBuilder

Returns:

the current builder instance.
setAlgorithmParameters
(AlgorithmParameters
algorithmParameters for content encryption.
algorithmParameters
)

Provide a set of algorithm parameters for the content encryption cipher to use.

public JceCMSContentEncryptorBuilder

Returns:

the current builder instance.
setProvider
(Provider
the provider object to use for cipher and default parameters creation.
provider
)

Set the provider to use for content encryption.

public JceCMSContentEncryptorBuilder

Returns:

the current builder instance.
setProvider
(String
the name of the provider to use for cipher and default parameters creation.
providerName
)

Set the provider to use for content encryption (by name)

public JceCMSContentEncryptorBuilder

Returns:

the current builder instance.
setSecureRandom
(SecureRandom
the secure random to use.
random
)

Provide a specified source of randomness to be used for session key and IV/nonce generation.

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

algorithmIdentifierback to summary
private AlgorithmIdentifier algorithmIdentifier
algorithmParametersback to summary
private AlgorithmParameters algorithmParameters
encryptionOIDback to summary
private final ASN1ObjectIdentifier encryptionOID
helperback to summary
private EnvelopedDataHelper helper
KEY_SIZE_PROVIDERback to summary
private static final SecretKeySizeProvider KEY_SIZE_PROVIDER
keySizeback to summary
private final int keySize
randomback to summary
private SecureRandom random

Constructor Detail

JceCMSContentEncryptorBuilderback to summary
public JceCMSContentEncryptorBuilder(ASN1ObjectIdentifier encryptionOID)
JceCMSContentEncryptorBuilderback to summary
public JceCMSContentEncryptorBuilder(ASN1ObjectIdentifier encryptionOID, int keySize)
JceCMSContentEncryptorBuilderback to summary
public JceCMSContentEncryptorBuilder(AlgorithmIdentifier encryptionAlgId)

Constructor for a content encryptor builder based on an algorithm identifier and its contained parameters.

Parameters
encryptionAlgId:AlgorithmIdentifier

the full algorithm identifier for the encryption.

Method Detail

buildback to summary
public OutputEncryptor build() throws CMSException
checkForAEADback to summary
private static boolean checkForAEAD()
setAlgorithmParametersback to summary
public JceCMSContentEncryptorBuilder setAlgorithmParameters(AlgorithmParameters algorithmParameters)

Provide a set of algorithm parameters for the content encryption cipher to use.

Parameters
algorithmParameters:AlgorithmParameters

algorithmParameters for content encryption.

Returns:JceCMSContentEncryptorBuilder

the current builder instance.

setProviderback to summary
public JceCMSContentEncryptorBuilder setProvider(Provider provider)

Set the provider to use for content encryption.

Parameters
provider:Provider

the provider object to use for cipher and default parameters creation.

Returns:JceCMSContentEncryptorBuilder

the current builder instance.

setProviderback to summary
public JceCMSContentEncryptorBuilder setProvider(String providerName)

Set the provider to use for content encryption (by name)

Parameters
providerName:String

the name of the provider to use for cipher and default parameters creation.

Returns:JceCMSContentEncryptorBuilder

the current builder instance.

setSecureRandomback to summary
public JceCMSContentEncryptorBuilder setSecureRandom(SecureRandom random)

Provide a specified source of randomness to be used for session key and IV/nonce generation.

Parameters
random:SecureRandom

the secure random to use.

Returns:JceCMSContentEncryptorBuilder

the current builder instance.

org.bouncycastle.cms.jcajce back to summary

private Class JceCMSContentEncryptorBuilder.CMSAuthOutputEncryptor

extends Object
implements OutputAEADEncryptor
Class Inheritance
  • java.lang.Object
  • org.bouncycastle.cms.jcajce.JceCMSContentEncryptorBuilder.CMSAuthOutputEncryptor
All Implemented Interfaces
org.bouncycastle.operator.OutputAEADEncryptor, org.bouncycastle.operator.AADProcessor, org.bouncycastle.operator.OutputEncryptor

Field Summary

Modifier and TypeField and Description
private AlgorithmIdentifier
private Cipher
private SecretKey
private MacCaptureStream

Constructor Summary

AccessConstructor and Description
pack-priv

Method Summary

Modifier and TypeMethod and Description
public OutputStream
getAADStream()

Implements org.bouncycastle.operator.AADProcessor.getAADStream.

Return a stream to write associated data to in order to have it incorporated into the AEAD cipher's MAC.
public AlgorithmIdentifier
getAlgorithmIdentifier()

Implements org.bouncycastle.operator.OutputEncryptor.getAlgorithmIdentifier.

Return the algorithm identifier describing the encryption algorithm and parameters this encryptor uses.
public GenericKey
getKey()

Implements org.bouncycastle.operator.OutputEncryptor.getKey.

Return the key used for encrypting the output.
public byte[]
getMAC()

Implements org.bouncycastle.operator.AADProcessor.getMAC.

Return the final value of AEAD cipher's MAC.
public OutputStream
getOutputStream(OutputStream
output stream for encrypted output.
dOut
)

Implements org.bouncycastle.operator.OutputEncryptor.getOutputStream.

Wrap the passed in output stream encOut, returning an output stream that encrypts anything passed in before sending on to encOut.
Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

algorithmIdentifierback to summary
private AlgorithmIdentifier algorithmIdentifier
cipherback to summary
private Cipher cipher
encKeyback to summary
private SecretKey encKey
macOutback to summary
private MacCaptureStream macOut

Constructor Detail

CMSAuthOutputEncryptorback to summary
pack-priv CMSAuthOutputEncryptor(ASN1ObjectIdentifier encryptionOID, int keySize, AlgorithmParameters params, SecureRandom random) throws CMSException

Method Detail

getAADStreamback to summary
public OutputStream getAADStream()

Implements org.bouncycastle.operator.AADProcessor.getAADStream.

Doc from org.bouncycastle.operator.AADProcessor.getAADStream.

Return a stream to write associated data to in order to have it incorporated into the AEAD cipher's MAC.

Returns:OutputStream

a stream for collecting associated data.

getAlgorithmIdentifierback to summary
public AlgorithmIdentifier getAlgorithmIdentifier()

Implements org.bouncycastle.operator.OutputEncryptor.getAlgorithmIdentifier.

Doc from org.bouncycastle.operator.OutputEncryptor.getAlgorithmIdentifier.

Return the algorithm identifier describing the encryption algorithm and parameters this encryptor uses.

Returns:AlgorithmIdentifier

algorithm oid and parameters.

getKeyback to summary
public GenericKey getKey()

Implements org.bouncycastle.operator.OutputEncryptor.getKey.

Doc from org.bouncycastle.operator.OutputEncryptor.getKey.

Return the key used for encrypting the output.

Returns:GenericKey

the encryption key.

getMACback to summary
public byte[] getMAC()

Implements org.bouncycastle.operator.AADProcessor.getMAC.

Doc from org.bouncycastle.operator.AADProcessor.getMAC.

Return the final value of AEAD cipher's MAC.

Returns:byte[]

MAC value for the AEAD cipher.

getOutputStreamback to summary
public OutputStream getOutputStream(OutputStream dOut)

Implements org.bouncycastle.operator.OutputEncryptor.getOutputStream.

Doc from org.bouncycastle.operator.OutputEncryptor.getOutputStream.

Wrap the passed in output stream encOut, returning an output stream that encrypts anything passed in before sending on to encOut.

Parameters
dOut:OutputStream

output stream for encrypted output.

Returns:OutputStream

an encrypting OutputStream

org.bouncycastle.cms.jcajce back to summary

private Class JceCMSContentEncryptorBuilder.CMSOutputEncryptor

extends Object
implements OutputEncryptor
Class Inheritance
  • java.lang.Object
  • org.bouncycastle.cms.jcajce.JceCMSContentEncryptorBuilder.CMSOutputEncryptor
All Implemented Interfaces
org.bouncycastle.operator.OutputEncryptor

Field Summary

Modifier and TypeField and Description
private AlgorithmIdentifier
private Cipher
private SecretKey

Constructor Summary

AccessConstructor and Description
pack-priv
CMSOutputEncryptor(ASN1ObjectIdentifier encryptionOID, int keySize, AlgorithmParameters params, SecureRandom random)

Method Summary

Modifier and TypeMethod and Description
public AlgorithmIdentifier
getAlgorithmIdentifier()

Implements org.bouncycastle.operator.OutputEncryptor.getAlgorithmIdentifier.

Return the algorithm identifier describing the encryption algorithm and parameters this encryptor uses.
public GenericKey
getKey()

Implements org.bouncycastle.operator.OutputEncryptor.getKey.

Return the key used for encrypting the output.
public OutputStream
getOutputStream(OutputStream
output stream for encrypted output.
dOut
)

Implements org.bouncycastle.operator.OutputEncryptor.getOutputStream.

Wrap the passed in output stream encOut, returning an output stream that encrypts anything passed in before sending on to encOut.
Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

algorithmIdentifierback to summary
private AlgorithmIdentifier algorithmIdentifier
cipherback to summary
private Cipher cipher
encKeyback to summary
private SecretKey encKey

Constructor Detail

CMSOutputEncryptorback to summary
pack-priv CMSOutputEncryptor(ASN1ObjectIdentifier encryptionOID, int keySize, AlgorithmParameters params, SecureRandom random) throws CMSException

Method Detail

getAlgorithmIdentifierback to summary
public AlgorithmIdentifier getAlgorithmIdentifier()

Implements org.bouncycastle.operator.OutputEncryptor.getAlgorithmIdentifier.

Doc from org.bouncycastle.operator.OutputEncryptor.getAlgorithmIdentifier.

Return the algorithm identifier describing the encryption algorithm and parameters this encryptor uses.

Returns:AlgorithmIdentifier

algorithm oid and parameters.

getKeyback to summary
public GenericKey getKey()

Implements org.bouncycastle.operator.OutputEncryptor.getKey.

Doc from org.bouncycastle.operator.OutputEncryptor.getKey.

Return the key used for encrypting the output.

Returns:GenericKey

the encryption key.

getOutputStreamback to summary
public OutputStream getOutputStream(OutputStream dOut)

Implements org.bouncycastle.operator.OutputEncryptor.getOutputStream.

Doc from org.bouncycastle.operator.OutputEncryptor.getOutputStream.

Wrap the passed in output stream encOut, returning an output stream that encrypts anything passed in before sending on to encOut.

Parameters
dOut:OutputStream

output stream for encrypted output.

Returns:OutputStream

an encrypting OutputStream