Automation of decryption

Frank Calfo frank.calfo@csgpro.com
Mon Oct 6 23:44:02 CEST 2003


--=====================_2463271==.ALT
Content-Type: text/plain; charset="us-ascii"; format=flowed

I have created a few batch files to automate encryption and decryption, 
even with a keystore that is password protected.

To decrypt a file encrypted via passphrase-based encryption, the following 
command within a batch file has been working well on Windows:

@rem Script wrapper for GNU PGP utility function: Decrypt a file encrypted 
with password-based encryption
@rem Arguments: 1 - password that file was encrypted with
@rem            2 - path to EFTS keystore
@rem            3 - fully qualified name of decrypted file to create
@rem            4 - fully qualified name of encrypted file to decrypt
@rem Watch it! - on Windows do NOT include space between %1 and the pipe 
(|) - will get bad
@rem passphrase error

echo %1| gpg --homedir %2 --batch --yes --passphrase-fd 0 --output %3 
--decrypt %4


To decrypt a file encrypted via key-based encryption, the following command 
within a batch file has been working well on Windows. Note that this is 
same as previous example.  Only difference is that previous one passed in 
encryption password under argument #1 while this one passes keystore 
password under argument #1:

@rem Script wrapper for GNU PGP utility function: Decrypt a file encrypted 
with key-based encryption
@rem Arguments: 1 - password to EFTS keystore
@rem            2 - path to EFTS keystore
@rem            3 - fully qualified name of decrypted file to create
@rem            4 - fully qualified name of encrypted file to decrypt
@rem Watch it! - on Windows do NOT include space between %1 and the pipe 
(|) - will get bad
@rem passphrase error

echo %1| gpg --homedir %2 --batch --yes --passphrase-fd 0 --output %3 
--decrypt %4


hth,
Frank


At 02:57 PM 10/6/2003 -0400, Jenkins, Brian P. wrote:
>Please help me understand how I can run GPG to decrypt a file without 
>human intervention.  Currently I can use the --yes to handle all questions 
>but cannot feed in the passphrase.  I'm using v1.2.3 for windows and am 
>very new to the product.
>
>Brian
>
>
>This e-mail and any accompanying attachments are confidential. The 
>information is intended solely for the use of the individual to whom it is 
>addressed. Any review, disclosure, copying, distribution, or use of this 
>e-mail communication by others is strictly prohibited. If you are not the 
>intended recipient, please notify us immediately by returning this message 
>to the sender and delete all copies. Thank you for your cooperation.

--=====================_2463271==.ALT
Content-Type: text/html; charset="us-ascii"

<html>
<body>
I have created a few batch files to automate encryption and decryption,
even with a keystore that is password protected.<br><br>
To decrypt a file encrypted via passphrase-based encryption, the
following command within a batch file has been working well on
Windows:<br><br>
@rem Script wrapper for GNU PGP utility function: Decrypt a file
encrypted with password-based encryption<br>
@rem Arguments: 1 - password that file was encrypted with<br>
@rem&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 2
- path to EFTS keystore<br>
@rem&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 3
- fully qualified name of decrypted file to create<br>
@rem&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 4
- fully qualified name of encrypted file to decrypt<br>
@rem Watch it! - on Windows do NOT include space between %1 and the pipe
(|) - will get bad <br>
@rem passphrase error<br><br>
echo %1| gpg --homedir %2 --batch --yes --passphrase-fd 0 --output %3
--decrypt %4<br><br>
<br>
To decrypt a file encrypted via key-based encryption, the following
command within a batch file has been working well on Windows. Note that
this is same as previous example.&nbsp; Only difference is that previous
one passed in encryption password under argument #1 while this one passes
keystore password under argument #1:<br><br>
@rem Script wrapper for GNU PGP utility function: Decrypt a file
encrypted with key-based encryption<br>
@rem Arguments: 1 - password to EFTS keystore<br>
@rem&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 2
- path to EFTS keystore<br>
@rem&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 3
- fully qualified name of decrypted file to create<br>
@rem&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 4
- fully qualified name of encrypted file to decrypt<br>
@rem Watch it! - on Windows do NOT include space between %1 and the pipe
(|) - will get bad <br>
@rem passphrase error<br><br>
echo %1| gpg --homedir %2 --batch --yes --passphrase-fd 0 --output %3
--decrypt %4<br><br>
<br>
hth,<br>
Frank<br><br>
<br>
At 02:57 PM 10/6/2003 -0400, Jenkins, Brian P. wrote:<br>
<blockquote type=cite class=cite cite><font face="arial" size=2>Please
help me understand how I can run GPG to decrypt a file without human
intervention.&nbsp; Currently I can use the --yes to handle all questions
but cannot feed in the passphrase.&nbsp; I'm using v1.2.3 for windows and
am very new to the product.</font><br>
&nbsp;<br>
<font face="arial" size=2>Brian</font><br><br>
<br>
This e-mail and any accompanying attachments are confidential. The
information is intended solely for the use of the individual to whom it
is addressed. Any review, disclosure, copying, distribution, or use of
this e-mail communication by others is strictly prohibited. If you are
not the intended recipient, please notify us immediately by returning
this message to the sender and delete all copies. Thank you for your
cooperation. </blockquote></body>
</html>

--=====================_2463271==.ALT--





More information about the Gnupg-users mailing list