Top Inners Fields Constructors Methods
org.bouncycastle.cms.bc

public Class BcCMSContentEncryptorBuilder

extends Object
Class Inheritance
Imports
java.io.IOException, .OutputStream, java.security.SecureRandom, org.bouncycastle.asn1.ASN1ObjectIdentifier, org.bouncycastle.asn1.oiw.OIWObjectIdentifiers, org.bouncycastle.asn1.pkcs.PKCSObjectIdentifiers, org.bouncycastle.asn1.x509.AlgorithmIdentifier, org.bouncycastle.cms.CMSException, org.bouncycastle.crypto.CipherKeyGenerator, org.bouncycastle.crypto.modes.AEADBlockCipher, org.bouncycastle.crypto.params.KeyParameter, org.bouncycastle.crypto.util.CipherFactory, org.bouncycastle.operator.DefaultSecretKeySizeProvider, .GenericKey, .MacCaptureStream, .OutputAEADEncryptor, .OutputEncryptor, .SecretKeySizeProvider

Nested and Inner Type Summary

Modifier and TypeClass and Description
private static class
private class
private class

Field Summary

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

Constructor Summary

AccessConstructor and Description
public
public

Method Summary

Modifier and TypeMethod and Description
public OutputEncryptor
public BcCMSContentEncryptorBuilder
Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

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

BcCMSContentEncryptorBuilderback to summary
public BcCMSContentEncryptorBuilder(ASN1ObjectIdentifier encryptionOID)
BcCMSContentEncryptorBuilderback to summary
public BcCMSContentEncryptorBuilder(ASN1ObjectIdentifier encryptionOID, int keySize)

Method Detail

buildback to summary
public OutputEncryptor build() throws CMSException
setSecureRandomback to summary
public BcCMSContentEncryptorBuilder setSecureRandom(SecureRandom random)
org.bouncycastle.cms.bc back to summary

private Class BcCMSContentEncryptorBuilder.AADStream

extends OutputStream
Class Inheritance

Field Summary

Modifier and TypeField and Description
private AEADBlockCipher

Constructor Summary

AccessConstructor and Description
public

Method Summary

Modifier and TypeMethod and Description
public void
write(byte[]
the data.
buf
,
int
the start offset in the data.
off
,
int
the number of bytes to write.
len
)

Overrides java.io.OutputStream.write.

Writes len bytes from the specified byte array starting at offset off to this output stream.
public void
write(int
the byte.
b
)

Implements abstract java.io.OutputStream.write.

Writes the specified byte to this output stream.
Inherited from java.io.OutputStream:
closeflushnullOutputStreamwrite

Field Detail

cipherback to summary
private AEADBlockCipher cipher

Constructor Detail

AADStreamback to summary
public AADStream(AEADBlockCipher cipher)

Method Detail

writeback to summary
public void write(byte[] buf, int off, int len) throws IOException

Overrides java.io.OutputStream.write.

Doc from java.io.OutputStream.write.

Writes len bytes from the specified byte array starting at offset off to this output stream. The general contract for write(b, off, len) is that some of the bytes in the array b are written to the output stream in order; element b[off] is the first byte written and b[off+len-1] is the last byte written by this operation.

If b is null, a NullPointerException is thrown.

If off is negative, or len is negative, or off+len is greater than the length of the array b, then an IndexOutOfBoundsException is thrown.

Parameters
buf:byte[]

the data.

off:int

the start offset in the data.

len:int

the number of bytes to write.

Exceptions
IOException:
if an I/O error occurs. In particular, an IOException is thrown if the output stream is closed.
writeback to summary
public void write(int b) throws IOException

Implements abstract java.io.OutputStream.write.

Doc from java.io.OutputStream.write.

Writes the specified byte to this output stream. The general contract for write is that one byte is written to the output stream. The byte to be written is the eight low-order bits of the argument b. The 24 high-order bits of b are ignored.

Parameters
b:int

the byte.

Exceptions
IOException:
if an I/O error occurs. In particular, an IOException may be thrown if the output stream has been closed.
org.bouncycastle.cms.bc back to summary

private Class BcCMSContentEncryptorBuilder.CMSAuthOutputEncryptor

extends CMSOutputEncryptor
implements OutputAEADEncryptor
Class Inheritance
All Implemented Interfaces
org.bouncycastle.operator.OutputAEADEncryptor, org.bouncycastle.operator.AADProcessor, org.bouncycastle.operator.OutputEncryptor

Field Summary

Modifier and TypeField and Description
private AEADBlockCipher
private MacCaptureStream
Inherited from org.bouncycastle.cms.bc.BcCMSContentEncryptorBuilder.CMSOutputEncryptor:
cipher

Constructor Summary

AccessConstructor and Description
pack-priv
CMSAuthOutputEncryptor(ASN1ObjectIdentifier encryptionOID, int keySize, SecureRandom random)

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.
private AEADBlockCipher
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
)

Overrides org.bouncycastle.cms.bc.BcCMSContentEncryptorBuilder.CMSOutputEncryptor.getOutputStream.

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 org.bouncycastle.cms.bc.BcCMSContentEncryptorBuilder.CMSOutputEncryptor:
getAlgorithmIdentifiergetKey

Field Detail

aeadCipherback to summary
private AEADBlockCipher aeadCipher
macOutback to summary
private MacCaptureStream macOut

Constructor Detail

CMSAuthOutputEncryptorback to summary
pack-priv CMSAuthOutputEncryptor(ASN1ObjectIdentifier encryptionOID, int keySize, 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.

getCipherback to summary
private AEADBlockCipher getCipher()
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)

Overrides org.bouncycastle.cms.bc.BcCMSContentEncryptorBuilder.CMSOutputEncryptor.getOutputStream.

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.bc back to summary

private Class BcCMSContentEncryptorBuilder.CMSOutputEncryptor

extends Object
implements OutputEncryptor
Class Inheritance
  • java.lang.Object
  • org.bouncycastle.cms.bc.BcCMSContentEncryptorBuilder.CMSOutputEncryptor
All Implemented Interfaces
org.bouncycastle.operator.OutputEncryptor
Known Direct Subclasses
org.bouncycastle.cms.bc.BcCMSContentEncryptorBuilder.CMSAuthOutputEncryptor

Field Summary

Modifier and TypeField and Description
private AlgorithmIdentifier
protected Object
private KeyParameter

Constructor Summary

AccessConstructor and Description
pack-priv
CMSOutputEncryptor(ASN1ObjectIdentifier encryptionOID, int keySize, 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
protected Object cipher
encKeyback to summary
private KeyParameter encKey

Constructor Detail

CMSOutputEncryptorback to summary
pack-priv CMSOutputEncryptor(ASN1ObjectIdentifier encryptionOID, int keySize, 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