Skip to content

Commit

Permalink
Use the value "None" for the ALGORITHMS column in the X509Certificate…
Browse files Browse the repository at this point in the history
…Database

This should allow the Npgsql backend to work (apparently it doesn't allow null)

Fixes issue #286
  • Loading branch information
jstedfast committed Mar 9, 2017
1 parent a17ad62 commit 0737089
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions MimeKit/Cryptography/X509CertificateDatabase.cs
Original file line number Diff line number Diff line change
Expand Up @@ -241,6 +241,9 @@ static EncryptionAlgorithm[] DecodeEncryptionAlgorithms (DbDataReader reader, in
var algorithms = new List<EncryptionAlgorithm> ();
var values = reader.GetString (column);

if (values.Equals ("None", StringComparison.OrdinalIgnoreCase))
return null;

foreach (var token in values.Split (new [] { ',' }, StringSplitOptions.RemoveEmptyEntries)) {
EncryptionAlgorithm algorithm;

Expand All @@ -262,8 +265,8 @@ static EncryptionAlgorithm[] DecodeEncryptionAlgorithms (DbDataReader reader, in

static string EncodeEncryptionAlgorithms (EncryptionAlgorithm[] algorithms)
{
if (algorithms == null)
return null;
if (algorithms == null || algorithms.Length == 0)
return "None";

var tokens = new string[algorithms.Length];
for (int i = 0; i < algorithms.Length; i++)
Expand Down

0 comments on commit 0737089

Please sign in to comment.