Skip to content

Commit a4dfbe2

Browse files
committed
check for duplicate PEMs
1 parent b0819c4 commit a4dfbe2

1 file changed

Lines changed: 9 additions & 1 deletion

File tree

digicert-certcentral-caplugin/CertCentralCAPlugin.cs

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -615,7 +615,7 @@ public Dictionary<string, PropertyConfigInfo> GetTemplateParameterAnnotations()
615615
{
616616
Comments = "Optional for secure_email_* types, ignored otherwise. Valid values are: strict, multipurpose. Use 'multipurpose' if your cert includes any additional EKUs such as client auth. Default if not provided is dependent on product configuration within Digicert portal.",
617617
Hidden = false,
618-
DefaultValue = "strict",
618+
DefaultValue = "",
619619
Type = "String"
620620
},
621621
[CertCentralConstants.Config.FIRST_NAME] = new PropertyConfigInfo()
@@ -1557,6 +1557,7 @@ private List<AnyCAPluginCertificate> GetAllConnectorCertsForOrder(string caReque
15571557
var orderCerts = GetAllCertsForOrder(orderId);
15581558

15591559
List<AnyCAPluginCertificate> certList = new List<AnyCAPluginCertificate>();
1560+
List<string> pemList = new List<string>();
15601561

15611562
foreach (var cert in orderCerts)
15621563
{
@@ -1578,6 +1579,13 @@ private List<AnyCAPluginCertificate> GetAllConnectorCertsForOrder(string caReque
15781579
throw new Exception($"Unexpected error downloading certificate {certId} for order {orderId}: {certificateChainResponse.Errors.FirstOrDefault()?.message}");
15791580
}
15801581
}
1582+
//Another check for duplicate PEMs to get arround issue with DigiCert API returning incorrect data sometimes on reissued/duplicate certs
1583+
if (pemList.Contains(certificate))
1584+
{
1585+
_logger.LogWarning($"Found duplicate PEM for ID {caReqId}. Skipping...");
1586+
continue;
1587+
}
1588+
pemList.Add(certificate);
15811589
var connCert = new AnyCAPluginCertificate
15821590
{
15831591
CARequestID = caReqId,

0 commit comments

Comments
 (0)