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

<depend…


This content originally appeared on DEV Community and was authored by wennan xu

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
...
<dependencies>
    ...
    <dependency>
        <groupId>org.pgpainless</groupId>
        <artifactId>pgpainless-core</artifactId>
        <version>1.7.2</version>
    </dependency>
    ...
</dependencies>

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

  1. Suppose you have a FileInputStream or ByteArrayInputStream. Then also you need to have a OutputStream, like
OutputStream outputStream =
                        Files.newOutputStream(outputFileLocation, StandardOpenOption.CREATE_NEW);
  1. Before you call the Painless.encryptAndOrSign(), you need to build up the ProducerOptions. It will be like ProducerOptions options = ProducerOptions.signAndEncrypt(signingOptions, encryptionOptions);


This content originally appeared on DEV Community and was authored by wennan xu


Print Share Comment Cite Upload Translate Updates
APA

wennan xu | Sciencx (2025-03-09T00:02:38+00:00) How to use pgpainless-core. Retrieved from https://www.scien.cx/2025/03/09/how-to-use-pgpainless-core/

MLA
" » How to use pgpainless-core." wennan xu | Sciencx - Sunday March 9, 2025, https://www.scien.cx/2025/03/09/how-to-use-pgpainless-core/
HARVARD
wennan xu | Sciencx Sunday March 9, 2025 » How to use pgpainless-core., viewed ,<https://www.scien.cx/2025/03/09/how-to-use-pgpainless-core/>
VANCOUVER
wennan xu | Sciencx - » How to use pgpainless-core. [Internet]. [Accessed ]. Available from: https://www.scien.cx/2025/03/09/how-to-use-pgpainless-core/
CHICAGO
" » How to use pgpainless-core." wennan xu | Sciencx - Accessed . https://www.scien.cx/2025/03/09/how-to-use-pgpainless-core/
IEEE
" » How to use pgpainless-core." wennan xu | Sciencx [Online]. Available: https://www.scien.cx/2025/03/09/how-to-use-pgpainless-core/. [Accessed: ]
rf:citation
» How to use pgpainless-core | wennan xu | Sciencx | https://www.scien.cx/2025/03/09/how-to-use-pgpainless-core/ |

Please log in to upload a file.




There are no updates yet.
Click the Upload button above to add an update.

You must be logged in to translate posts. Please log in or register.