public class PgpEncryptionUtility extends Object
Provides methods to encrypt files using a PGP public key, supporting both key file paths and direct key objects.
| Constructor | Description |
|---|---|
PgpEncryptionUtility() |
| Modifier and Type | Method | Description |
|---|---|---|
static byte[] |
handlePGPEncrypt(File inputFile,
org.bouncycastle.openpgp.PGPPublicKey pgpPublicKey) |
Encrypts the given input file using the provided PGP public key.
|
static byte[] |
handlePGPEncrypt(File inputFile,
String pgpPublicKeyPath) |
Encrypts the given input file using the PGP public key located at the specified path.
|
static void |
setBufferSize(int size) |
Optionally sets the buffer size used during encryption.
|
public static byte[] handlePGPEncrypt(File inputFile, String pgpPublicKeyPath) throws IOException, org.bouncycastle.openpgp.PGPException, IllegalArgumentException
inputFile - The file to encrypt.pgpPublicKeyPath - The file path to the PGP public key.IOException - If an I/O error occurs.org.bouncycastle.openpgp.PGPException - If a PGP error occurs.IllegalArgumentException - If required arguments are missing.public static byte[] handlePGPEncrypt(File inputFile, org.bouncycastle.openpgp.PGPPublicKey pgpPublicKey) throws IOException, org.bouncycastle.openpgp.PGPException
inputFile - The file to encrypt.pgpPublicKey - The PGP public key to use for encryption.IOException - If an I/O error occurs.org.bouncycastle.openpgp.PGPException - If a PGP error occurs.IllegalArgumentException - If required arguments are missing.public static void setBufferSize(int size)
size - The buffer size in bytes.Copyright © 2026. All rights reserved.