org.bouncycastle.openpgp.operator.PGPDataEncryptor Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of bcpg-jdk15on Show documentation
Show all versions of bcpg-jdk15on Show documentation
The Bouncy Castle Java API for handling the OpenPGP protocol. This jar contains the OpenPGP API for JDK 1.5 to JDK 1.7. The APIs can be used in conjunction with a JCE/JCA provider such as the one provided with the Bouncy Castle Cryptography APIs.
package org.bouncycastle.openpgp.operator;
import java.io.OutputStream;
/**
* A data encryptor, combining a cipher instance and an optional integrity check calculator.
*
* {@link PGPDataEncryptor} instances are generally not constructed directly, but obtained from a
* {@link PGPDataEncryptorBuilder}.
*
*/
public interface PGPDataEncryptor
{
/**
* 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.
*
* @param out the stream to wrap and write encrypted data to.
* @return a cipher output stream appropriate to the type of this data encryptor.
*/
OutputStream getOutputStream(OutputStream out);
/**
* Obtains the integrity check calculator configured for this encryptor instance.
*
* @return the integrity check calculator, or null
if no integrity checking was
* configured.
*/
PGPDigestCalculator getIntegrityCalculator();
/**
* Gets the block size of the underlying cipher used by this encryptor.
*
* @return the block size in bytes.
*/
int getBlockSize();
}