Skip to content

Commit 71d4797

Browse files
committed
improve BouncyCastle parsing
1 parent 69211ee commit 71d4797

1 file changed

Lines changed: 6 additions & 2 deletions

File tree

digicert-certcentral-caplugin/CertCentralCAPlugin.cs

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
using Keyfactor.Extensions.CAPlugin.DigiCert.Client;
66
using Keyfactor.Extensions.CAPlugin.DigiCert.Models;
77
using Keyfactor.Logging;
8+
using Keyfactor.PKI;
89
using Keyfactor.PKI.Enums;
910
using Keyfactor.PKI.Enums.EJBCA;
1011

@@ -105,12 +106,15 @@ public async Task<EnrollmentResult> Enroll(string csr, string subject, Dictionar
105106
string commonName = null, organization = null, orgUnit = null;
106107
try
107108
{
108-
subjectParsed = new X509Name(subject);
109+
subjectParsed = new X509Name(true, PKIConstants.X509.OIDLookup, subject);
109110
commonName = subjectParsed.GetValueList(X509Name.CN).Cast<string>().LastOrDefault();
110111
organization = subjectParsed.GetValueList(X509Name.O).Cast<string>().LastOrDefault();
111112
orgUnit = subjectParsed.GetValueList(X509Name.OU).Cast<string>().LastOrDefault();
112113
}
113-
catch (Exception) { }
114+
catch (Exception exc)
115+
{
116+
_logger.LogInformation($"Error while parsing subject. This might be expected. Error message: {exc.Message}");
117+
}
114118

115119
if (commonName == null)
116120
{

0 commit comments

Comments
 (0)