Skip to content

Commit 1532c13

Browse files
committed
Fixed DigitalCertificate.DnsNames to return unicode domain names
1 parent 5846a22 commit 1532c13

3 files changed

+9
-3
lines changed

MimeKit/Cryptography/BouncyCastleCertificateExtensions.cs

+6
Original file line numberDiff line numberDiff line change
@@ -202,6 +202,9 @@ static string[] GetSubjectAlternativeNames (X509Certificate certificate, int tag
202202
/// </exception>
203203
public static string GetSubjectEmailAddress (this X509Certificate certificate, bool idnEncode = false)
204204
{
205+
if (certificate == null)
206+
throw new ArgumentNullException (nameof (certificate));
207+
205208
var address = certificate.GetSubjectNameInfo (X509Name.EmailAddress);
206209

207210
if (string.IsNullOrEmpty (address)) {
@@ -233,6 +236,9 @@ public static string GetSubjectEmailAddress (this X509Certificate certificate, b
233236
/// </exception>
234237
public static string[] GetSubjectDnsNames (this X509Certificate certificate, bool idnEncode = false)
235238
{
239+
if (certificate == null)
240+
throw new ArgumentNullException (nameof (certificate));
241+
236242
var domains = GetSubjectAlternativeNames (certificate, GeneralName.DnsName);
237243

238244
if (idnEncode) {

MimeKit/Cryptography/SecureMimeDigitalCertificate.cs

+2-2
Original file line numberDiff line numberDiff line change
@@ -130,7 +130,7 @@ public string Fingerprint {
130130
/// </remarks>
131131
/// <value>The email address.</value>
132132
public string Email {
133-
get { return Certificate.GetSubjectEmailAddress (true); }
133+
get { return Certificate.GetSubjectEmailAddress (false); }
134134
}
135135

136136
/// <summary>
@@ -141,7 +141,7 @@ public string Email {
141141
/// </remarks>
142142
/// <value>The DNS name.</value>
143143
public string[] DnsNames {
144-
get { return Certificate.GetSubjectDnsNames (true); }
144+
get { return Certificate.GetSubjectDnsNames (false); }
145145
}
146146

147147
/// <summary>

MimeKit/Cryptography/WindowsSecureMimeDigitalCertificate.cs

+1-1
Original file line numberDiff line numberDiff line change
@@ -140,7 +140,7 @@ public string Email {
140140
/// </remarks>
141141
/// <value>The DNS name.</value>
142142
public string[] DnsNames {
143-
get { return Certificate.GetSubjectDnsNames (true); }
143+
get { return Certificate.GetSubjectDnsNames (false); }
144144
}
145145

146146
/// <summary>

0 commit comments

Comments
 (0)