I encryptd a file using gpg, now I want to decrypt the file.
Is there any way to decrypt the file without need to import the secret file?
We have the secret key in a file called key.sec; can we pass the secret file to gpg as a parameter (when we run the decrypt command from the bash command line) to use when decrypting the encrypted file? Or must we import the secret key then decrypt the encrypted files?
You must add the secret key to a keyring. From the
gpg(1)documentation:You could
--import --no-default-keyring --secret-keyring temporaryto import the key, use--secret-keyring temporarywhen decrypting the content, then delete the~/.gnupg/temporary.gpgfile when you’re done. But that’s just a work-around.