This repository provides a tutorial and example code for implementing PGP (Pretty Good Privacy) encryption and decryption in Java using the Bouncy Castle library. π
PGP is an asymmetric encryption algorithm that uses public-key cryptography to secure data communication. It involves generating a pair of keys: a public key for encryption and a private key for decryption.π
Before getting started, make sure you have the following prerequisites:
- Java Development Kit (JDK) installed on your system π₯
- Bouncy Castle library added to your project dependencies π¦
To get started with PGP encryption and decryption in Java, follow these steps:
- Clone this repository to your local machine using the following command:
git clone https://github.com/iridhicode/pgp-encryption-decryption
- Open the project in your favorite Java IDE. π»
- Make sure you have the Bouncy Castle library added to your project dependencies. You can download it from the Bouncy Castle website or add it using a build tool like Maven or Gradle. π
- Generate a pair of public and private keys for the sender and receiver. You can use the
ssh-keygen
command-line tool or any other PGP key generation tool. π
To use the PGP encryption and decryption functionality, follow these steps:
- Update the main method in the
PGPReader
class with the appropriate file paths for your input file, private key, public keys, and email addresses. π - Run the main method to perform encryption and decryption. π
- The encrypted file will be generated, and the decrypted file will be output to the console or saved to a file, depending on your implementation. π€
Contributions to this project are welcome! If you find any issues or have suggestions for improvement, please open an issue or submit a pull request. π€