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:
committed by
Adam Langley
parent
c4711a569a
commit
d43a35d821
@@ -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])))
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user