About Peculiar problem i encountered.
One of my colleagues wanted to send a pgp public key to the client. I thought it was for encrypting mails and created a key pair in Openpgp(Thunderbird) and sent the public key. But at last it turned out that the key was used to encrypt files and not mails.
We have to use gpg command in linux for encrypting/decypting files. I tried importing the public key(that i sent) to the gpg keyring in the machine that had encrypted files.
$gpg --import <public-key-file
and tried decrypting the file:
gpg -o output-file --decrypt encrypted_file
But it did not work. By no way i could decrypt the files. Then a thought stuck me that "Shouldn't i import the private key to decrypt the file rather than the public key". So, i tried the key management tool in
Openpgp(Thunderbird). In that i selected my key and exported it to a file. I compared that key file with my public key. I noticed that the file that i exported from Thunderbird had both private and public key
info. I copied the key file to the system having all the encrypted files. Then i imported the copied key
to the keyring with:
#gpg --import keyfile eg: gpg --import my.key.asc
This imported both the public key and secret key(private key). I could see the keys with:
#gpg --list-keys
#gpg --list-secret-keys
Then i used gpg to decrypt the files:
gpg gpg -o output-file --decrypt encrypted_file
This did the trick and i was able to decrypt all the files one by one.
No comments:
Post a Comment