BouncyCastle implementation of RSA-OAEP and OpenPGP encryption/decryption mechanisms
I've seen some people are having difficulties finding a complete working solution, which implements encryption and decryption with RSA-OAEP(Optimal Asymmetric Encryption Padding) and OpenPGP standards. This is my own implementation as a collection of thoughts from a task that I had implementated in my daily job. I hope some people will find it usefull.
I've tested this on Ubuntu (Native and in Windows Sybsystem for Linux), commands provided are for use in the Terminal. There are many other options to generate keys, this is my preferred option.
openssl genrsa -aes256 -out private.pem 4096
-> this will be a guided prompt that will generate a private keyopenssl rsa -in private.pem -pubout > public.pem
-> this will extract public key from a private key previously generated
gpg --full-generate-key
-> this will be a full guided prompt to generate a set of public and private keypairgpg --list-keys
-> this will list all public keys, copy the key id for the next commandgpg --export -a 80C42804012256AF85D9AACAC3462FE2F1C35E09 > public.gpg
-> this will extract the public key to be used for encryptiongpg --list-secret-keys
-> this will list all private keys available, copy the id to be ued in the next commandgpg --export-secret-key -a 80C42804012256AF85D9AACAC3462FE2F1C35E09 > private.gpg
-> this will exctrat the private key for the id provided
- Implement signature option with signing key for encrypted message with OpenPGP
Any comments/suggestions are very welcome, please enjoy.