fabacab / wp-pgp-encrypted-emails

:closed_lock_with_key: :e-mail: Encrypts WordPress emails using OpenPGP or S/MIME with a familiar API.
https://wordpress.org/plugins/wp-pgp-encrypted-emails/
GNU General Public License v3.0
39 stars 10 forks source link

OpenKeychain fails to recognize ASCII armor when lines exceed 64 chars #11

Closed fabacab closed 8 years ago

fabacab commented 8 years ago

Weird issue, but seems like a solid bug report: https://wordpress.org/support/topic/ascii-armor-strings-compatibility-issue-with-openkeychain?replies=2#post-8212698

@DanielRuf, can you think of any reason why this would be a dangerous change to make? I can't and am thinking of rolling it into the next release to improve compatibility.

DanielRuf commented 8 years ago

64 should be ok, already using it here https://github.com/jasonhinkle/php-gpg/blob/dbdd6b22cd2e9a1181c291f84f9a4b7e479d7446/libs/GPG.php#L182

And they also use a width of 64 here https://hackage.haskell.org/package/openpgp-asciiarmor-0.1/docs/src/Codec-Encryption-OpenPGP-ASCIIArmor-Encode.html

Not 100% sure but at least the PEM RFC says each line should have 64 characters http://crypto.stackexchange.com/a/19055/12434

The default width for wordwrap is 75. http://php.net/manual/en/function.wordwrap.php

string wordwrap ( string $str [, int $width = 75 [, string $break = "\n" [, bool $cut = false ]]] )

Generally this should not make any problems and a width of 64 is expected in some PGP clients. Should be changed in the next release.

Oversaw that there was a width of 75 / the default value of wordwrap used.