2

Is it possible to display the ciphers used for encryption using GPG?

I figured out that using the verbose flags while decrypting yields the needed information:

gpg: encrypted with 4096-bit RSA key, ID 1122334455667788, created 2017-09-01

gpg: AES256 encrypted data

:compressed packet: algo=2

So I have two questions relating this.

  • Is this information encrypted (using the public-key) ?
  • Can the information be printed?

Clarification: I want to see the public-key algorithm and the symmetrical cipher.

2

The information is viewable with the gpg command:

mtak@rubiks:~/.password-store/test(master)$ gpg --list-packets -vv --show-session-key test.gpg
# off=0 ctb=85 tag=1 hlen=3 plen=524
:pubkey enc packet: version 3, algo 1, keyid 0062798D743AC1D3
  data: [4096 bits]
gpg: public key is 0062798D743AC1D3
gpg: using subkey 0062798D743AC1D3 instead of primary key B3A64441695490BB
gpg: public key encrypted data: good DEK
# off=527 ctb=d2 tag=18 hlen=2 plen=164 new-ctb
:encrypted data packet:
  length: 164
  mdc_method: 2
gpg: using subkey 0062798D743AC1D3 instead of primary key B3A64441695490BB
gpg: encrypted with 4096-bit RSA key, ID 0062798D743AC1D3, created 2016-07-27
      "Merijntje Tak <xxx@xxx.net>"
gpg: AES256 encrypted data
gpg: session key: '9:0712ABE10B7F0246B70A9138A3722E277028C6A1FA581A8CCEE6DC4B867E5AD6'
# off=548 ctb=ac tag=11 hlen=2 plen=121
:literal data packet:
  mode b (62), created 1514453162, name="zTDbDQ-test-test.txt",
  raw data: 98 bytes
gpg: decryption okay

The symmetric cipher is encrypted. When trying to '--list-packets' using a GPG that doesn't have access to the private key, it shows:

test@rubiks:~$ gpg --list-packets -vv --show-session-key test.gpg  
# off=0 ctb=85 tag=1 hlen=3 plen=524
:pubkey enc packet: version 3, algo 1, keyid 0062798D743AC1D3
    data: [4095 bits]
gpg: public key is 0062798D743AC1D3
# off=527 ctb=d2 tag=18 hlen=2 plen=165 new-ctb
:encrypted data packet:
    length: 165
    mdc_method: 2
gpg: encrypted with RSA key, ID 0062798D743AC1D3
gpg: decryption failed: No secret key
  • I didn't think of using file. It's nice to display public-key cryptosystem but it does not show the symmetrical algorithm. – coffeemakr Jan 4 '18 at 12:26
  • You're right, I have updated my answer showing the asymmetric and symmetric algorithm. – mtak Jan 4 '18 at 12:56
0

The information in your example can be obtained using gpg --list-packets.

(Alternatively, pgpdump shows the same OpenPGP structures in a different format.)

  • Thanks! The list gpg --list-packets doesn't show the AES part. gpg --list-packets --verbose solved this. pgpdump reveals that the private key is needed to get the symmetric algorithm: Encrypted data [sym alg is specified in pub-key encrypted session key] – coffeemakr Jan 4 '18 at 15:38

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.