Fix K-9 stable: OpenPGP: Unknown compression algorithm #1752

Signed-off-by: Durgesh <007durgesh219@gmail.com>
This commit is contained in:
Durgesh 2016-03-06 18:38:45 +05:30
parent 201c38ec02
commit 8b8b91e247

View file

@ -470,7 +470,13 @@ public class PgpSignEncryptOperation extends BaseOperation {
InputStream in = new BufferedInputStream(inputData.getInputStream());
if (enableCompression) {
compressGen = new PGPCompressedDataGenerator(input.getCompressionAlgorithm());
// Use preferred compression algo
int algo = input.getCompressionAlgorithm();
if (algo == PgpSecurityConstants.OpenKeychainCompressionAlgorithmTags.USE_DEFAULT) {
algo = PgpSecurityConstants.DEFAULT_COMPRESSION_ALGORITHM;
}
compressGen = new PGPCompressedDataGenerator(algo);
bcpgOut = new BCPGOutputStream(compressGen.open(out));
} else {
bcpgOut = new BCPGOutputStream(out);