Text file encryption and decryption using bouncy castle Library
Traditionally , in legacy application the secret keys were present in the protected packages folder in local application environment only. Google Key Maker re-defined App Security bringing in tighter security guidelines to secure the way application communicate each other by encrypting the files (text or pdf or word or jpeg etc.) and send it over the network .
More Info : https://cloud.google.com/kms/
Application to improve the security of files transmitted over the network has to be at the highest security standards. Bouncy Castle Libraries is used by Symmetric , Asymmetric, PGP Encryption internally by the frameworks.
-
Standalone Java 1.8+ Application with libraries (jdk or jre)
-
Bouncy Castle PGP Encryption https://www.bouncycastle.org/latest_releases.html
-
Application Name - args[0]
-
KeyName - Key_trial_1, Key_trial_2, Key_trial_3 - args[1]
-
Operation Name - ENC => Encryption , DEC => Decryption - args[2]
-
Absolute Path File Name - eg. C:/Users/sampleDir/file_sample_input.txt - for the encryption/decryption file utility. - args[3]
-
Input Text File - To be sent for encryption
-
Encrypted Output Text File - Absolute Path should be specified
-
Decrypted Output Text File - Absolute Path should be specified
Get the input from the User Interface or args[] - App name, Key name , Operation Name (Encryption (ENC) or Decryption (DEC)), Path of File Name for encryption. Do the validation checks for the user inputs. Generate the JWT Token ID from the Google KMS keys Get the response back from the Google KMS agent - PGP key which is BASE64 encoded from the response JSON of the Keymaker API. Decrypt the base64 keymaker response keys and use bouncy castle to encrypt the file using OpenPGP Encryption. Test the scenarios for lossless data encryption and decryption .