Top Description Methods
org.bouncycastle.openpgp.operator

public Interface PGPDataEncryptorBuilder

Known Direct Implementers
org.bouncycastle.openpgp.operator.jcajce.JcePGPDataEncryptorBuilder
Imports
java.security.SecureRandom, org.bouncycastle.bcpg.SymmetricKeyAlgorithmTags, org.bouncycastle.openpgp.PGPException

A builder for PGPDataEncryptor instances, which can be used to encrypt data objects.

Method Summary

Modifier and TypeMethod and Description
public PGPDataEncryptor

Returns:

a data encryptor with an initialised cipher.
build
(byte[]
the bytes of the key to use for the cipher.
keyBytes
)

Builds a data encryptor using the algorithm configured for this builder.

public int

Returns:

one of the symmetric encryption algorithms.
getAlgorithm
()

The encryption algorithm used by data encryptors created by this builder.

public SecureRandom
getSecureRandom()

Gets the SecureRandom instance used by this builder.

public PGPDataEncryptorBuilder
setWithAEAD(int
the AEAD mode to use.
aeadAlgorithm
,
int
the size of the chunks to be processed with each nonce.
chunkSize
)

Sets whether or not the resulting encrypted data will be protected using an AEAD mode.

public PGPDataEncryptorBuilder

Returns:

the current builder.
setWithIntegrityPacket
(boolean
true if an integrity packet is to be included, false otherwise.
withIntegrityPacket
)

Sets whether or not the resulting encrypted data will be protected using an integrity packet.

Method Detail

buildback to summary
public PGPDataEncryptor build(byte[] keyBytes) throws PGPException

Builds a data encryptor using the algorithm configured for this builder.

Parameters
keyBytes:byte[]

the bytes of the key to use for the cipher.

Returns:PGPDataEncryptor

a data encryptor with an initialised cipher.

Exceptions
PGPException:
if an error occurs initialising the configured encryption.
getAlgorithmback to summary
public int getAlgorithm()

The encryption algorithm used by data encryptors created by this builder.

Returns:int

one of the symmetric encryption algorithms.

getSecureRandomback to summary
public SecureRandom getSecureRandom()

Gets the SecureRandom instance used by this builder.

If a SecureRandom has not been explicitly configured, a default SecureRandom is constructed and retained by the this builder.

setWithAEADback to summary
public PGPDataEncryptorBuilder setWithAEAD(int aeadAlgorithm, int chunkSize)

Sets whether or not the resulting encrypted data will be protected using an AEAD mode. The chunkSize is used as a power of two, result in blocks (1 << chunkSize) containing data with an extra 16 bytes for the tag. The minimum chunkSize is 6.

Parameters
aeadAlgorithm:int

the AEAD mode to use.

chunkSize:int

the size of the chunks to be processed with each nonce.

setWithIntegrityPacketback to summary
public PGPDataEncryptorBuilder setWithIntegrityPacket(boolean withIntegrityPacket)

Sets whether or not the resulting encrypted data will be protected using an integrity packet.

Parameters
withIntegrityPacket:boolean

true if an integrity packet is to be included, false otherwise.

Returns:PGPDataEncryptorBuilder

the current builder.