Posts

Showing posts with the label key

Export public-private keys from PFX file

Image
In this blog I'll share the snippets used to export the public key & private key from a PFX file. Sometimes we have to perform the data encryption/decryption using the digital signature by taking the public key(so called as SSL certificate or public keys)  to encrypt the data and private key to decrypt the data. Let's take the sample DSCs provided by eMudhra- https://www.e-mudhra.com/Repository/ I have taken " e-Mudhra sub CA for Class 3 Individual 2014"  for this blog. This zip contains two files as- Class 3 individiual test_encryption.pfx- For data encryption/decryption Class 3 individiual test_Signature.pfx- For signing the document We'll take the file  Class 3 individiual test_encryption.pfx for this blog and follow the below steps to obtain the public key & private key. A linux machine with openssl utility Run the following command to extract the private key openssl pkcs12 -in Class_3_individiual_test_encryption.pfx -nocerts -out private_key.key If pr...

Accessing remote linux machine from MacOS with key

Image
There is a scenario where I have to access a remote linux machine via MacOS. Login mechanism is allowed though key and not a password. I have provided a PPK file which I can use for authentication purpose. PPK File Not Supported by MacOS The PPK file is not directly supported by MacOS terminal, rather we need a PEM(.pem) file for authentication. So first we need to convert this *.ppk file to *.pem file then after the same will be used for authentication purpose. We need to install  PuTTYgen (windows)  first. Normally it comes with installer of PuTTY but if not installed, check this link-   PuTTYgen Converting  a .ppk file to a .pem file Start PuTTYgen. Under Actions , choose Load , and then navigate to your .ppk file. Choose the .ppk file, and then choose Open . Clear the Key passphrase and a Confirm passphrase fields. Note: The passphrase is used to encrypt the key and is an extra layer of protection. If your private key...