openpgp: Add support for BZIP2-compressed data packets.

Tested using a variety of files encrypted with gpg and the
"--compress-algo BZIP2" gpg option.

R=golang-dev, bradfitz, agl
CC=golang-dev
https://golang.org/cl/10801043
This commit is contained in:
Brian Gitonga Marete
2013-07-03 11:31:17 -04:00
committed by Adam Langley
parent c4711a569a
commit d43a35d821
+3
View File
@@ -6,6 +6,7 @@ package packet
import (
"code.google.com/p/go.crypto/openpgp/errors"
"compress/bzip2"
"compress/flate"
"compress/zlib"
"io"
@@ -30,6 +31,8 @@ func (c *Compressed) parse(r io.Reader) error {
c.Body = flate.NewReader(r)
case 2:
c.Body, err = zlib.NewReader(r)
case 3:
c.Body = bzip2.NewReader(r)
default:
err = errors.UnsupportedError("unknown compression algorithm: " + strconv.Itoa(int(buf[0])))
}