Skip to content

Armored data whitespace questions

I have several questions regarding whitespace in armored data:

  • What is considered to be a line ending? LF? CR+LF? Both? Either LF or CR+LF depending on which is first encountered (all subsequent line endings must match)?

  • Section 6 "Base64 Conversions" says:

    When decoding base64, an OpenPGP implementation MUST ignore all white space.

    • What is the definition of whitespace? Does it include line endings? What about "exotic" Unicode white space, which would require UTF-8 decoding to detect?
    • Does this include extraneous empty lines before/within/after the block of base64 lines?
    • Does this include whitespace before/within/after the base64 characters in the optional checksum line?
    • Does this include whitespace before the = of the optional checksum line?
  • Section 6 also says:

    ...it is wrapped into lines of no more than 76 characters each.

    Does that count include the "ignored" white space?

  • If the optional checksum is omitted, is the whole line excluded or is there a blank line where the checksum would be? (Perhaps "Optional checksum" should be replaced with "Optional checksum line".)

  • Is a newline required between the checksum and the tail? (I'm confident the answer is yes, but the wording could be clearer.) Similarly, if the checksum is omitted, is a newline required between the final base64 character and the tail?

  • Section 6.2.1 "Armor Header Line" says:

    The header lines, therefore, MUST start at the beginning of a line, and MUST NOT have text other than whitespace following them on the same line.

    This implies that trailing whitespace is allowed on the -----BEGIN *----- header line, but nowhere else is this supported. In fact, this directly conflicts with the previous sentence:

    Note that all these Armor Header Lines are to consist of a complete line.

    So which is it? The header text is the complete line, or the header text can be followed by optional whitespace?

Edited by Richard Hansen