PGP public key
PGP public key can be transfered either as a text within another message or inside an .asc file. It is then used by PGP software to encrypt some data or to confirm the signature signed by the associated private key.
The file is encoded in ASCII characters, but can be saved in any plain text format (for example UTF-8).
File contents
The beginning of the file will always be:
-----BEGIN PGP PUBLIC KEY BLOCK-----
Although the case of the letters maybe different
The second line normally describes the software used to generate the key, and the third line is empty.
The key itself starts on line 4, and can go on for an arbitrary number of lines. It is encoded using all the letters of Latin alphabet (English language) in both cases [A-Za-z], characters + and /. Newlines maybe inserted at any point, normally after the 64th character on the line, but these characters are not themselves part of the key and are used for ease of viewing and transfer only.
The last line of the key will normally have less than 64 characters and may end with = symbol.
After the key there is a short line, starting with = and followed by 4 characters.
The end of the file is shown by the line (with case being variant as well):
-----END PGP PUBLIC KEY BLOCK-----
The last line may or may not end with the newline character.
Newline characters used may be different, depending on the software used to produce the key, but normally are \n (Char(13)).
Example
-----BEGIN PGP PUBLIC KEY BLOCK----- Version: GnuPG v1.4.14 (GNU/Linux) mQENBFMXKocBCAD05ZjZxEQOFQNpMFbG+NErbJv83VZXvhzOVWDSoO5gcIQKj0+1 UMmwUfnPqBbP5X50losqH1gfJ1bspn/8n0AWK9KIgQjMPGltfdpDdb2X8Wm2X36P Bz9HSi34mFTWLN+IjHhUpnpPQff8rbCa7TuNw3LXPjF6Kea/RcwtiSswYUI8St36 LGA9YTry4EY/XVs+vE1XCfl5RN0JsVtHkENX69pvxcxZH45GiqStB9PpYjce5EAl /rrg/uzhWtAzwnZDaBS0okS5ZVZAIjh2rQoP117TGY9Zr4qSoM4kaLlzli5Gxc9h 3c1LEJqoWIRzYXgNjTa7c230c9jXMURw9AqVABEBAAG0MFZsYWRpbWlyIE1vemhl bmtvdiA8VmxhZGltaXJNb3poZW5rb3ZAeWFob28uY29tPokBPgQTAQIAKAUCUxcq hwIbIwUJA8JnAAYLCQgHAwIGFQgCCQoLBBYCAwECHgECF4AACgkQ7sXLZa0eCOVR KwgA8khi9YVdFNdSXmx2mKCi3KMuRdPYNdAWyS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