Encrypted file filename

Werner Koch wk at gnupg.org
Thu Oct 27 18:24:51 CEST 2005

On Thu, 27 Oct 2005 09:18:50 -0500, Wes  said:

> I also see --set-filename.  However, I don't see any way to read the
> embedded file name.

[GNUPG:] PLAINTEXT 62 1130429959 x
#                  mode timestamp filename

> file name to rebuild some headers before sending the file on.  It needs to
> decrypt the message to a known file, then build the headers with the
> original file name.

That is the way PGP does it.  We now have support in gpgme for reading
the orginal filename.  Note that the filename is optional, in
particular you won't see one if you pipe data into gpg.

> I guess the file could be decrypted into an empty temp directory, then use
> opendir/readdir to find whatever filename shows up there.  That seems a bit
> kludgy, though.

Or well, rename it after having saved it under a temporary name.

> Also, is the embedded file name guaranteed to be just a file name, or could
> it be a full path, which would present a rather significant problem?

It is just an utf-8 string without any restrictions.  In fact it might
even contain 0x00 (GnuPG can't create such a message)



More information about the Gnupg-users mailing list