openpgp: improve parser resilience & flexibility, add PublicKey.BitLength()

These are improvements I've made as necessary to develop Hockeypuck,
an OpenPGP keyserver (https://launchpad.net/hockeypuck).

The max armor line length was increased to 96 because some keyservers (SKS)
will output armor with lines greater than 64 (the prior max).

I've exposed packet.ReadEntity to support stream-parsing, useful for
large SKS dump files.

ReadKeyRing attempts to recover in the event of malformed data.

Because many packet types are not yet supported, I added OpaquePacket to
capture unsupported types for offline storage and later reparsing.

R=agl
CC=golang-dev
https://golang.org/cl/6927044
This commit is contained in:
Casey Marshall
2012-12-15 14:30:05 -05:00
committed by Adam Langley
parent 84f97f92d0
commit 2da167fbbe
5 changed files with 183 additions and 6 deletions
+1 -1
View File
@@ -111,7 +111,7 @@ func (l *lineReader) Read(p []byte) (n int, err error) {
return 0, io.EOF
}
if len(line) > 64 {
if len(line) > 96 {
return 0, ArmorCorrupt
}