1

I have recently found that openPGP, the protocol that GnuPG uses, uses a hybrid-cryptosystem by generating a random session key, encrypting the message using that key with a strong, symmetric cipher, before encrypting the session key with the recipients public key.

When you view an actual PGP message, you see what appears to one big block of base64 characters between a clear header and footer. However, if the ciphertext for the message and the ciphertext for the session key are sent alongside each other, why does a PGP message appear as one big block of text?

closed as off-topic by Steffen Ullrich, Xander, Stephane, Steve, HashHazard Nov 14 '16 at 22:18

This question appears to be off-topic. The users who voted to close gave this specific reason:

  • "This question does not appear to be about Information security within the scope defined in the help center." – Steffen Ullrich, Xander, Stephane, Steve, HashHazard
If this question can be reworded to fit the rules in the help center, please edit the question.

2

PGP messages come in a raw binary format that comprises multiple packets as specified in RFC 4880. There is nothing exciting about the syntax. For instance, every packet in a message consists of a header and a body with the first byte of the header being the header tag, etc. You can dissect a PGP message just like you would with a TCP packet.

What you identified as "one big block of base64" is called an ASCII armor. As the name suggests and @SteffenUllrich pointed out, it protects the message from getting corrupted during transfer by representing it with printable ASCII characters. All it does is base64-wrapping the OpenPGP format.

If you wanted to parse an ASCII armored message you would first base64-decode it and then parse the contained binary stream according to the syntax specification.

From section 2.4 of the RFC:

2.4.  Conversion to Radix-64

   OpenPGP's underlying native representation for encrypted messages,
   signature certificates, and keys is a stream of arbitrary octets.
   Some systems only permit the use of blocks consisting of seven-bit,
   printable text.  For transporting OpenPGP's native raw binary octets
   through channels that are not safe to raw binary data, a printable
   encoding of these binary octets is needed.  OpenPGP provides the
   service of converting the raw 8-bit binary octet stream to a stream
   of printable ASCII characters, called Radix-64 encoding or ASCII
   Armor.

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