gpg doesn't fail on target file existing when decrypting

Andrew Flerchinger icrf.ml at gmail.com
Mon Mar 16 19:48:25 CET 2009


On Mon, Mar 16, 2009 at 12:10 PM, <vedaal at hush.com> wrote:

> Andrew Flerchinger icrf.ml at gmail.com
> wrote on Mon Mar 16 14:10:31 CET 2009 :
>
>
> > If I pass in --yes, it does indeed overwrite as I'd
> > If I don't, it does NOT overwrite the file.
>
> > it's just not telling me there was a problem with
> > decryption like it does when I'm encrypting something.
>
>
> there isn't a problem with decrypting,
>
> gnupg asks if you want to overwrite,
> and if you answer no (N)
> then it asks you where you want the file to be written to
>
> here is what i get when i try it (on windows) without the --yes
> option :
>
>
> c:\gnupg>gpg --passphrase aaaa1 --output c:\q.txt --decrypt
> c:\q.txt.gpg
> :pubkey enc packet: version 3, algo 1, keyid 7DC4274AF9015496
>        data: [2047 bits]
> gpg: public key is F9015496
>
> You need a passphrase to unlock the secret key for
> user: "aaaa1 <aaaa1 at key.test>"
> 2048-bit RSA key, ID F9015496, created 2005-12-01
>
> gpg: encrypted with 2048-bit RSA key, ID F9015496, created 2005-12-
> 01
>      "aaaa1 <aaaa1 at key.test>"
> gpg: TWOFISH encrypted data
> :compressed packet: algo=1
> :literal data packet:
>        mode b (62), created 1236869352, name="q.txt",
>        raw data: 3 bytes
> gpg: original file name='q.txt'
> File `c:\q.txt' exists. Overwrite? (y/N) n
> Enter new filename:
> Enter new filename: c:\q2.txt
> gpg: decryption okay
> gpg: session key:
> `10:6EB46AC795C6CCB418116E50DDFDC8CBD3D345761C2759DD5223E8D5D30923DC
> '
>
> n.b.
> i use the options of 'verbose verbose',
> so gnupg gives a lot more information than what you might be used
> to seeing
>
> here it is again without the 'verbose' options:
>
> c:\gnupg>gpg --passphrase aaaa1 --output c:\q.txt --decrypt
> c:\q.txt.gpg
>
> You need a passphrase to unlock the secret key for
> user: "aaaa1 <aaaa1 at key.test>"
> 2048-bit RSA key, ID F9015496, created 2005-12-01
>
> gpg: encrypted with 2048-bit RSA key, ID F9015496, created 2005-12-
> 01
>      "aaaa1 <aaaa1 at key.test>"
> File `c:\q.txt' exists. Overwrite? (y/N) y
> gpg: session key:
> `10:6EB46AC795C6CCB418116E50DDFDC8CBD3D345761C2759DD5223E8D5D30923DC
> '
>
> c:\gnupg>
>
>
> so,
> does gnupg prompt you to 'overwrite' if you don't use the --yes
> option ?
>
>
> vedaal
>

Yes, I do see that behavior. The primary difference is that I never want it
to prompt me for anything, since I'm writing a headless wrapper. Try
including the --batch parameter, which suppresses any interaction. I can't
find any indication that it failed to overwrite the destination by return
code or program output.

It works just fine when encrypting, though, which is what has me confused. I
can work around it (mostly, the operation won't be atomic, but it's probably
close enough for me), but the inconsistency between encrypt/decrypt gave me
pause.

Thanks.
Andrew
-------------- next part --------------
An HTML attachment was scrubbed...
URL: </pipermail/attachments/20090316/1c98a01f/attachment-0001.htm>


More information about the Gnupg-users mailing list