ruby-gpgme
ruby-gpgme copied to clipboard
Get the original filename before encryption
I am working on a project in which I have to decrypt some gpg files that do not come with the file extension explicit, just data.gpg
It would be very useful to be able to get the original filename.
I think this is related to #62, #99 except --use-embedded-filename would have to be exposed. Although, I should point out GnuPG considers this option to be unsafe: "This can be a dangerous option as it enables overwriting files. Defaults to no." https://www.gnupg.org/documentation/manuals/gnupg/GPG-Esoteric-Options.html#index-use_002dembedded_002dfilename (search for "--use-" as this link doesn't quite take you to the right option). You can get around this by naming the outputted gpg file like the_name_i_want.zip.gpg. Most gpg clients will simply strip off the .gpg (or .asc) and use the remaining part as the filename. Some (especially GUI clients) have an option to do this that needs to be turned on first.
is there a way to set the file name or a name for encryption? ``` crypto = GPGME::Crypto.new options = @options data = crypto.encrypt byte_array, options data.file_name=('sample_file_name')
Such that the output file has a name? When the encrypted string is written to a file? For example:
gpg --list-packets outt.gpg
:literal data packet:
mode b (62), created 1547573148, name="",
raw data: 23 bytes