PGPDataEncryptorBuilder implementation that sources cryptographic primitives using the
JCE APIs.
By default, cryptographic primitives will be loaded using the default JCE load order (i.e.
without specifying a provider).
A specific provider can be specified using one of the setProvider(String) methods.
| Modifier and Type | Class and Description |
|---|---|
| private class | |
| private class |
| Modifier and Type | Field and Description |
|---|---|
| private int | |
| private int | |
| private int | |
| private OperatorHelper | |
| private SecureRandom | |
| private boolean |
| Access | Constructor and Description |
|---|---|
| public | JcePGPDataEncryptorBuilder(int
one of the encAlgorithm)supported symmetric cipher
algorithms. May not be SymmetricKeyAlgorithmTags#NULL.Constructs a new data encryptor builder for a specified cipher type. |
| Modifier and Type | Method and Description |
|---|---|
| public PGPDataEncryptor | build(byte[]
the bytes of the key to use for the cipher. keyBytes)Implements org. |
| public int | getAlgorithm()
Implements org. |
| public SecureRandom | getSecureRandom()
Implements org. |
| public JcePGPDataEncryptorBuilder | Returns: the current builder.the JCE provider to use. provider)Sets the JCE provider to source cryptographic primitives from. |
| public JcePGPDataEncryptorBuilder | Returns: the current builder.the name of the JCE provider to use. providerName)Sets the JCE provider to source cryptographic primitives from. |
| public JcePGPDataEncryptorBuilder | Returns: the current builder.the secure random to be used. random)Provide a user defined source of randomness. |
| public JcePGPDataEncryptorBuilder | setWithAEAD(int
the AEAD mode to use. aeadAlgorithm, int the size of the chunks to be processed with each nonce. chunkSize)Implements org. |
| public JcePGPDataEncryptorBuilder | Returns: the current builder.true if an integrity packet is to be included, false otherwise. withIntegrityPacket)Implements org. |
| aeadAlgorithm | back to summary |
|---|---|
| private int aeadAlgorithm | |
| chunkSize | back to summary |
|---|---|
| private int chunkSize | |
| encAlgorithm | back to summary |
|---|---|
| private int encAlgorithm | |
| helper | back to summary |
|---|---|
| private OperatorHelper helper | |
| random | back to summary |
|---|---|
| private SecureRandom random | |
| withIntegrityPacket | back to summary |
|---|---|
| private boolean withIntegrityPacket | |
| JcePGPDataEncryptorBuilder | back to summary |
|---|---|
| public JcePGPDataEncryptorBuilder(int encAlgorithm) Constructs a new data encryptor builder for a specified cipher type.
| |
| build | back to summary |
|---|---|
| public PGPDataEncryptor build(byte[] keyBytes) throws PGPException Implements org. Doc from org. Builds a data encryptor using the algorithm configured for this builder.
| |
| getAlgorithm | back to summary |
|---|---|
| public int getAlgorithm() Implements org. Doc from org. The encryption algorithm used by data encryptors created by this builder.
| |
| getSecureRandom | back to summary |
|---|---|
| public SecureRandom getSecureRandom() Implements org. Doc from org. Gets the SecureRandom instance used by this builder.
If a SecureRandom has not been explicitly configured, a default | |
| setProvider | back to summary |
|---|---|
| public JcePGPDataEncryptorBuilder setProvider(Provider provider) Sets the JCE provider to source cryptographic primitives from.
| |
| setProvider | back to summary |
|---|---|
| public JcePGPDataEncryptorBuilder setProvider(String providerName) Sets the JCE provider to source cryptographic primitives from.
| |
| setSecureRandom | back to summary |
|---|---|
| public JcePGPDataEncryptorBuilder setSecureRandom(SecureRandom random) Provide a user defined source of randomness. If no SecureRandom is configured, a default SecureRandom will be used.
| |
| setWithAEAD | back to summary |
|---|---|
| public JcePGPDataEncryptorBuilder setWithAEAD(int aeadAlgorithm, int chunkSize) Implements org. Doc from org. 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.
| |
| setWithIntegrityPacket | back to summary |
|---|---|
| public JcePGPDataEncryptorBuilder setWithIntegrityPacket(boolean withIntegrityPacket) Implements org. Sets whether or not the resulting encrypted data will be protected using an integrity packet.
| |
| Modifier and Type | Field and Description |
|---|---|
| private final Cipher | |
| private final byte[] | |
| private final byte[] |
| Access | Constructor and Description |
|---|---|
| pack-priv |
| Modifier and Type | Method and Description |
|---|---|
| public int | |
| public int | getBlockSize()
Implements org. |
| public int | |
| public PGPDigestCalculator | getIntegrityCalculator()
Implements org. |
| public byte[] | |
| public OutputStream | getOutputStream(OutputStream
the stream to wrap and write encrypted data to. out)Implements org. |
| c | back to summary |
|---|---|
| private final Cipher c | |
| iv | back to summary |
|---|---|
| private final byte[] iv | |
| keyBytes | back to summary |
|---|---|
| private final byte[] keyBytes | |
| MyAeadDataEncryptor | back to summary |
|---|---|
| pack-priv MyAeadDataEncryptor(byte[] keyBytes) throws PGPException | |
| getAEADAlgorithm | back to summary |
|---|---|
| public int getAEADAlgorithm() Implements org. | |
| getBlockSize | back to summary |
|---|---|
| public int getBlockSize() Implements org. Doc from org. Gets the block size of the underlying cipher used by this encryptor.
| |
| getChunkSize | back to summary |
|---|---|
| public int getChunkSize() Implements org. | |
| getIntegrityCalculator | back to summary |
|---|---|
| public PGPDigestCalculator getIntegrityCalculator() Implements org. Doc from org. Obtains the integrity check calculator configured for this encryptor instance.
| |
| getIV | back to summary |
|---|---|
| public byte[] getIV() Implements org. | |
| getOutputStream | back to summary |
|---|---|
| public OutputStream getOutputStream(OutputStream out) Implements org. Doc from org. Constructs an encrypting output stream that encrypts data using the underlying cipher of this encryptor. The cipher instance in this encryptor is used for all output streams obtained from this method, so it should only be invoked once.
| |
| Access | Constructor and Description |
|---|---|
| pack-priv |
| Modifier and Type | Method and Description |
|---|---|
| public int | getBlockSize()
Implements org. |
| public PGPDigestCalculator | getIntegrityCalculator()
Implements org. |
| public OutputStream | getOutputStream(OutputStream
the stream to wrap and write encrypted data to. out)Implements org. |
| c | back to summary |
|---|---|
| private final Cipher c | |
| MyPGPDataEncryptor | back to summary |
|---|---|
| pack-priv MyPGPDataEncryptor(byte[] keyBytes) throws PGPException | |
| getBlockSize | back to summary |
|---|---|
| public int getBlockSize() Implements org. Doc from org. Gets the block size of the underlying cipher used by this encryptor.
| |
| getIntegrityCalculator | back to summary |
|---|---|
| public PGPDigestCalculator getIntegrityCalculator() Implements org. Doc from org. Obtains the integrity check calculator configured for this encryptor instance.
| |
| getOutputStream | back to summary |
|---|---|
| public OutputStream getOutputStream(OutputStream out) Implements org. Doc from org. Constructs an encrypting output stream that encrypts data using the underlying cipher of this encryptor. The cipher instance in this encryptor is used for all output streams obtained from this method, so it should only be invoked once.
| |