How to use pgpainless-core
Document https://pgpainless.readthedocs.io/en/latest/quickstart.html Setup // If you use Gradle ... dependencies { ... implementation "org.pgpainless:pgpainless-core:1.7.2" ... } // If you use Maven ... ... org.pgpainless pgpainless-core 1.7.2 ... What's ASCII Armor ASCII armor is a layer of radix64 encoding that can be used to wrap binary OpenPGP data in order to make it save to transport via text-based channels (e.g. email bodies). The way in which ASCII armor can be applied depends on the type of data that you want to protect. The easies way to ASCII armor an OpenPGP key or certificate is by using PGPainless’ asciiArmor() method: PGPPublicKey certificate = ...; String asciiArmored = PGPainless.asciiArmor(certificate); How to Encrypt message or file Suppose you have a FileInputStream or ByteArrayInputStream. Then also you need to have a OutputStream, like OutputStream outputStream = Files.newOutputStream(outputFileLocation, StandardOpenOption.CREATE_NEW); Before you call the Painless.encryptAndOrSign(), you need to build up the ProducerOptions. It will be like ProducerOptions options = ProducerOptions.signAndEncrypt(signingOptions, encryptionOptions);

Document
https://pgpainless.readthedocs.io/en/latest/quickstart.html
Setup
// If you use Gradle
...
dependencies {
...
implementation "org.pgpainless:pgpainless-core:1.7.2"
...
}
// If you use Maven
...
...
org.pgpainless
pgpainless-core
1.7.2
...
What's ASCII Armor
ASCII armor is a layer of radix64 encoding that can be used to wrap binary OpenPGP data in order to make it save to transport via text-based channels (e.g. email bodies).
The way in which ASCII armor can be applied depends on the type of data that you want to protect. The easies way to ASCII armor an OpenPGP key or certificate is by using PGPainless’ asciiArmor() method:
PGPPublicKey certificate = ...;
String asciiArmored = PGPainless.asciiArmor(certificate);
How to Encrypt message or file
- Suppose you have a
FileInputStream
orByteArrayInputStream
. Then also you need to have aOutputStream
, like
OutputStream outputStream =
Files.newOutputStream(outputFileLocation, StandardOpenOption.CREATE_NEW);
- Before you call the
Painless.encryptAndOrSign()
, you need to build up theProducerOptions
. It will be likeProducerOptions options = ProducerOptions.signAndEncrypt(signingOptions, encryptionOptions);