Skip to content

Commit

Permalink
Remove Version: header from armored OpenPGP output
Browse files Browse the repository at this point in the history
Fixes issue #319
  • Loading branch information
jstedfast committed Sep 3, 2017
1 parent 8f540d2 commit 6692cbf
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions MimeKit/Cryptography/OpenPgpContext.cs
Original file line number Diff line number Diff line change
Expand Up @@ -1370,6 +1370,8 @@ public ApplicationPgpSignature Sign (PgpSecretKey signer, DigestAlgorithm digest
var memory = new MemoryBlockStream ();

using (var armored = new ArmoredOutputStream (memory)) {
armored.SetHeader ("Version", null);

var compresser = new PgpCompressedDataGenerator (CompressionAlgorithmTag.ZLib);
using (var compressed = compresser.Open (armored)) {
var signatureGenerator = new PgpSignatureGenerator (signer.PublicKey.Algorithm, hashAlgorithm);
Expand Down Expand Up @@ -1569,6 +1571,8 @@ static Stream Encrypt (PgpEncryptedDataGenerator encrypter, Stream content)
var memory = new MemoryBlockStream ();

using (var armored = new ArmoredOutputStream (memory)) {
armored.SetHeader ("Version", null);

using (var compressed = Compress (content)) {
using (var encrypted = encrypter.Open (armored, compressed.Length)) {
compressed.CopyTo (encrypted, 4096);
Expand Down Expand Up @@ -1978,6 +1982,8 @@ public MimePart SignAndEncrypt (PgpSecretKey signer, DigestAlgorithm digestAlgo,

var memory = new MemoryBlockStream ();
using (var armored = new ArmoredOutputStream (memory)) {
armored.SetHeader ("Version", null);

using (var encrypted = encrypter.Open (armored, compressed.Length)) {
compressed.CopyTo (encrypted, 4096);
encrypted.Flush ();
Expand Down Expand Up @@ -2686,6 +2692,8 @@ public void Export (PgpPublicKeyRingBundle keys, Stream stream, bool armor)

if (armor) {
using (var armored = new ArmoredOutputStream (stream)) {
armored.SetHeader ("Version", null);

keys.Encode (armored);
armored.Flush ();
}
Expand Down

0 comments on commit 6692cbf

Please sign in to comment.