0

I have a test encrypted file on my computer that when I run

gpg(2) --verify message.txt.asc

I get:

gpg: Signature made Tue Mar  3 21:16:41 2015 PST using RSA key ID *******
gpg: Good signature from "John Doe <jdoe@email.com>"
gpg: WARNING: not a detached signature; file 'message.txt' was NOT verified!

And if I run

gpg(2) -d message.txt.asc

It does not prompt for the passphrase on my private key and yet still decrypts the gpg message. The other random .gpg/.asc files I have require that I decrypt them with a passphrase and --verify does not work.

What is the deal with the original file such that --verify works and I can decrypt without a passphrase? Is there a gpg command that analyzes a given file so I can gain context as to why it is not password protected? I thought it might be a detached signature (albeit without the default .sig extension) but there is a message in it as well. I do not have a gpg-agent running fwiw.

0

So I think I figured it out. The file in question must have been created with just the --sign option and not both --sign --encrypt. Based on looking at the file relative to another that was both signed and encrypted, you can see they both have signatures but the file created with only --sign does not have a :encrypted data packet and only has the literal data packet:

(10:35) gpg > gpg --list-packets test2.txt.enc.asc
:pubkey enc packet: version 3, algo 1, keyid
    data: [2048 bits]

You need a passphrase to unlock the secret key for
user: "John Doe <jdoe@email.com>"
2048-bit RSA key, ID ********, created 2015-02-28

:encrypted data packet:
    length: 405
    mdc_method: 2
gpg: encrypted with <a key>
:compressed packet: algo=2
:onepass_sig packet: keyid
    version 3, sigclass 0x00, digest 8, pubkey 1, last=1
:literal data packet:
    mode b (62), created 1463246548, name="test2.txt",
    raw data: 32 bytes
:signature packet: algo 1, keyid
    version 4, created 1463246548, md5len 0, sigclass 0x00
    digest algo 8, begin of digest 35 d8
    hashed subpkt 2 len 4 (sig created 2016-05-14)
    subpkt 16 len 8 (issuer key ID)
    data: [2045 bits]

Versus:

gpg > gpg --list-packets test2.txt.asc
:compressed packet: algo=1
:onepass_sig packet: keyid
    version 3, sigclass 0x00, digest 2, pubkey 1, last=1
:literal data packet:
    mode b (62), created 1463246421, name="test2.txt",
    raw data: 32 bytes
:signature packet: algo 1, keyid
    version 4, created 1463246421, md5len 0, sigclass 0x00
    digest algo 2, begin of digest b9 a7
    hashed subpkt 2 len 4 (sig created 2016-05-14)
    subpkt 16 len 8 (issuer key ID)
    data: [2047 bits]
  • If it's not encrypted, just look at it with a text editor, or even hex editor. Running file on it should say if it's a pgp/gpg file or not too – Xen2050 May 15 '16 at 3:34

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.