keybase / go-crypto

[mirror] Go supplementary cryptography libraries
https://godoc.org/golang.org/x/crypto
BSD 3-Clause "New" or "Revised" License
50 stars 20 forks source link

Find armor CRC even when it's folded to previous line #79

Closed zapu closed 5 years ago

zapu commented 5 years ago

Allow armors like:

-----BEGIN PGP ARMORED FILE-----
Comment: Use "gpg --dearmor" for unpacking

aGVsbG8gd29ybGQgMQo==hvYi
-----END PGP ARMORED FILE-----

where the =hvYi checksum is folded into previous line with data.

we need to do some gymnastics in our streaming parser to support that. If we encounter a line that ends with a checksum - so this also match "checksum lines", where the checksum is on separate line - if there is additional data before the checksum, make sure it's returned as well. Then try to skip empty lines looking for armorEnd.