How can I extract the --embedded-filename for scripting?
Henry Hertz Hobbit
hhhobbit at securemecca.net
Thu May 9 19:17:58 CEST 2013
On 05/09/2013 08:30 AM, Peter Lebbing wrote:
> On 08/05/13 21:01, Werner Koch wrote:
>> That is not crude but a standard Unix pattern.
>
> I considered putting the status-fd stuff into a file, then reading the file and
> finally deleting it a much cruder method than connecting the parsing logic to fd
> 3 directly.
>
> Peter.
Peter[gnat]digitalbrains[dot]com's way of doing it:
gpg --status-fd 3 --use-embedded-filename foo.gpg 3>foo.status
That is probably incompatible with Windows doing it. The
original poster already has the cmd.exe (BAT) script for doing
it finished already. The way I handle it on Windows is to
output the results of either stdout (>) or stderr (2>) to a
file and then open that file with VBScript. Trapping the result
in any Windows scripting language other than Power Shell (I am
NOT very familiar with it) is problematical.
That is why my advice is that the original file name should be
preserved with an added ".gpg" for the encrypted file to make
these things clear, e.g.:
Design-Files is a folder. It is zipped into either a
7-Zip or zip file with all the contents in the folder
zipped with it (recursive - the default for 7-Zip):
Design-Files 7zips to Design-Files.7z
Design-Files zips to Design-Files.zip
When encrypting:
Design-Files.zip is encrypted to Design-Files.zip.gpg
Design-Files.7z is encrypted to Design-Files.7z.gpg
MasterFile.txt is encrypted to MasterFile.txt.gpg
That way the file name alone gives a clue as to whether further
processing is necessary. I KNOW that VBScript can handle it
this way. The only problem is to put an unzipper program some
place in your %PATH% where there is no spaces or punctuation
to that folder for the zip.exe or 7z.exe that you are using.
One more thing. Windows Explorer should be set to show the
entire file name. That also prevents *.pdf.exe files appearing
to be *.pdf files as well. Ditto for *.doc.exe and similar
files. But it makes some of this explicit for OpenPGP
enciphered files and I KNOW that VBScript can handle it when
it is done this way.
'Nix way:
I am pretty sure that a grep for '\.tar\.gz', '\.tgz', /\.tbz'
and '\.7z' after deciphering and redirected to files and than
opening and processing those files on 'nix can also be done to
perform the addiitional processing automatically (use file
with a grep for certain patters as one last check), You are
better off for the temporary files being put in either the
current folder or ${HOME}/tmp if the perms on those folders
is 700. Use of /tmp or even /var/tmp is unsafe. unless you are
the only person on the system. Even if you are the only person
have the script remove the tmp files and unset the relevant VARS.
I turn history off in most of my scripts at the start and then
turn history back on at the end of the script if security is a
consideration:
http://www.securemecca.com/public/GnuPG/
HHH
More information about the Gnupg-users
mailing list