How to verify the file was successfully encrypted...

Bob gpg-news at
Sat Jul 15 19:45:49 CEST 2006

Benny Helms wrote:

> I'm looking for a way to gpg encrypt a file, test that the encryption
> was good and that the file can be extracted, and then to delete the
> original file.
> Even better would be a way to automatically remove the original when the
> encrypted version has been successfully created, if such a parameter
> exists.
> At the very least, though, a way of testing that the file encryption was
> successful without having to sit at my desk at 3AM running 'gpg
> --decrypt filename' to test it would be very helpful.


My suggestion:

On your server, calculate a hash for the unencrypted data file.

Encrypt the data file & transfer the encrypted file to a secure box 
which has your secret key. 

Decrypt the file on that secure box & compare the hash to the hash 
created on the server. If the hashes are the same then all is well & 
you can delete the files on the server.

This can all be scripted & it keeps your private key off the server.

I hope this helps,


{My apologize if this doesn't thread correctly]

More information about the Gnupg-users mailing list