Generate Private Public PGP key

 

We can generate Private Public PGP key and use it for our own message/files encryption, we have a public key (to lock/encrypt the message) and a private key (to unlock/decrypt the message). We would give our Public key to different vendor/client so that they can send us the encrypted sensitive message/files. Once we receive an encrypted message, we use our private key to decrypt it.

Will generate the Keys by using Kleopatra tool, please check and install the software before starting with this tutorial.

Installing Kleopatra

Once installed, run the Kleopatra

Click New Key Pair

Generate Private Public PGP key

 

Provide Name and Email, Click Next

Generate Private Public PGP key

 

Click Create

 

Add passphrase – for our POC we will use mulesy, please use strong password

Generate Private Public PGP key

 

Key Pair Successfully created

 

We can see the key now

 

Right click and export the Public key

 

In first export we will export the Public Key in Text format (.asc extension)

 

And then in binary format which is accepted by the MuleSoft Crypto (.gpg extension)

 

Similarly we will export the private key

 

Export both asc and gpg extension again in similar way how we generated the Public key

Generate Private Public PGP key

 

Now we have both public and private keys in both text and binary

 

We need two information for doing encryption and decryption in MuleSoft

  • Passphrase
  • Fingerprint

Passphrase we already set to mulesy while key creation and now let’s get the fingerprint

Right click on key and click on Details

Generate Private Public PGP key

 

Note down the fingerprint (remove spaces)4232E6BD7151FF89D9F755807AC70C45987C59AA Generate Private Public PGP key

 

So now we have required details about the key to use in MuleSoft

For Encryption

  • Fingerprint 4232E6BD7151FF89D9F755807AC70C45987C59AA
  • Public Key – Public_4232E6BD7151FF89D9F755807AC70C45987C59AA.gpg

For Decryption

  • Passphrase – mulesy
  • Fingerprint 4232E6BD7151FF89D9F755807AC70C45987C59AA
  • Private Key – Private_4232E6BD7151FF89D9F755807AC70C45987C59AA.gpg

This completes our first scenario and now you can pass on the Public key to your client for encryption.

Just to show we are on right track we can use below URL for testing our Private and Public Key

https://8gwifi.org/pgpencdec.jsp

Select the Encrypt Message and Paste your Message and Public key Text (from Public_4232E6BD7151FF89D9F755807AC70C45987C59AA.asc file)

We can see the Encrypted Message – Copy the same

Generate Private Public PGP key

 

Now Select Decrypt – Paste the encrypted message which we copied before along with Private Key Text (from Private_4232E6BD7151FF89D9F755807AC70C45987C59AA.asc extension) and the PassPhrase of the Private Key – mulesy

Click Decrypt and now we can see the Message which we encrypted in earlier step. Generate Private Public PGP key

 

Attaching all keys for reference – PGP_keys

 

 

  
Thank you for taking out time to read the above post. Hope you found it useful. In case of any questions, feel free to comment below. Also, if you are keen on knowing about a specific topic, happy to explore your recommendations as well.
 
For any latest updates or posts on our website, you can follow us on LinkedIn. Look forward to connecting with you there.


Share this:
Subscribe
Notify of
guest
0 Comments
Oldest
Newest Most Voted
Inline Feedbacks
View all comments