If I encrypt a file with gpg -c file.zip
, and change the filename. Is there any way I can restore the filename as I used as a password. or the name encrypted to?
2 Answers
Yes, gpg -c file.zip
does encode the input file name in the encrypted packet.
The gpg man page documents a few relevant options:
--set-filename string
Use string as the name of file which is stored in messages.
This overrides the default, which is to use the actual filename of the file being encrypted.
--use-embedded-filename
Try to create a file with a name as embedded in the data. This can be a dangerous option as it allows to overwrite files.
This defaults to no.
-
$\begingroup$ I understand this option so that the filename is inside the message. So the original author cannot reveal it without knowing the password. $\endgroup$– qbiNov 1, 2012 at 22:13
-
$\begingroup$ @ Ilmari Karonen, i try gpg --use-embedded-filename filename.gpg but it ask for password and not shown the old file name, did u mean 'This defaults to no.' that i should use the option before encrypt the file or it work by default. $\endgroup$ Nov 15, 2012 at 7:11
-
$\begingroup$ @illsecure: GPG will always ask for the password when decrypting symmetrically encrypted data. The original filename (if any) is stored inside the encrypted data packet, so GPG needs the password to decrypt it. $\endgroup$ Nov 15, 2012 at 12:15
-
$\begingroup$ so there are no way to save the file name inside the gpg file so I can read before give the password, thats all thanks for your answer. $\endgroup$ Nov 16, 2012 at 5:00
Usually there is no way to recover the old filename. If you change the name of a file, GnuPG doesn't know about this. Maybe you have backups and can recover the filename from there. Or you have to try to remember what the name was.
-
$\begingroup$ You can accept an answer in 6 minutes, so 'll wait may be some one hve a way to recover the name. $\endgroup$ Nov 1, 2012 at 16:22