Some useful information about GPG

Some useful information about GPG

OpenPGP is based on hybrid encryption, a random generated, symmetric key is encrypted with the recipient’s public key, usually RSA and that symmetric
key is itself used to encrypt the message body with a symmetric encryption algorithm, often AES or AES-256. The hybrid symmetric encryption is used due to limitations of asymmetric methods (message size and CPU). The symmetric key is random for each encryption and not stored on the sender’s side.

The following steps are useful to get some information about the encrypted message, especially to determine the used symmetric algorithm:

To verify the test result with gnupg follow this steps:

1. First of all make sure that you hava a valid private key, if not you can import the key with:

[ksr@localvm ~]$ gpg --import private.key
gpg: Key 0961DF15: secret key imported

2. Then decrypt the message with the –verbose parameters:

[ksr@localvm ~]$ gpg --verbose --verbose --decrypt enc128.gpg
:pubkey enc packet: version 3, algo 1, keyid D5435DC30961DF15
   data: [4095 bits]
gpg: public key is 0961DF15
gpg: With public key encrypted data: Correct DEK
:encrypted data packet:
   length: 133
gpg: encrypted with 4096-Bit RSA Key, ID 0961DF15, created 2016-03-08
      "MY TEST KEY <ksr@localvm.com>"
gpg: AES encrypted data
:compressed packet: algo=1
:literal data packet:
   mode t (74), created 1477052715, name="test_message.txt",
   raw data: 96 bytes
gpg: Original filename='test_message.txt'
EC000 OK
9 records processed successfully
0 records failed
Import ID: 8fbc6d38-fa56-4b71-a9f6-64gpg: Encryption successful
gpg: WARNING: Message was not integrity protected

The displayed data shows the used symmetric algorithm:

gpg: AES encrypted data

and for AES-256

gpg: AES256 encrypted data