Skip to content

Commit

Permalink
Fixed RC2 algorithm mapping for S/MIME
Browse files Browse the repository at this point in the history
Thanks to Alexander Bauer for this patch.

Fixes issue #337
  • Loading branch information
jstedfast committed Sep 12, 2017
1 parent 0478738 commit 794288f
Showing 1 changed file with 6 additions and 5 deletions.
11 changes: 6 additions & 5 deletions MimeKit/Cryptography/SecureMimeContext.cs
Original file line number Diff line number Diff line change
Expand Up @@ -833,13 +833,14 @@ internal protected static bool TryGetEncryptionAlgorithm (AlgorithmIdentifier id
}

if (identifier.Algorithm.Id == CmsEnvelopedGenerator.RC2Cbc) {
var param = (DerInteger) identifier.Parameters;
int bits = param.Value.IntValue;
var param = (DerSequence) identifier.Parameters;
var version = (DerInteger) param[0];
int bits = version.Value.IntValue;

switch (bits) {
case 128: algorithm = EncryptionAlgorithm.RC2128; return true;
case 64: algorithm = EncryptionAlgorithm.RC264; return true;
case 40: algorithm = EncryptionAlgorithm.RC240; return true;
case 58: algorithm = EncryptionAlgorithm.RC2128; return true;
case 120: algorithm = EncryptionAlgorithm.RC264; return true;
case 160: algorithm = EncryptionAlgorithm.RC240; return true;
}
}

Expand Down

0 comments on commit 794288f

Please sign in to comment.