Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 9 additions & 2 deletions digicert-certcentral-caplugin/CertCentralCAPlugin.cs
Original file line number Diff line number Diff line change
Expand Up @@ -1719,6 +1719,10 @@ private List<AnyCAPluginCertificate> GetAllConnectorCertsForOrder(string caReque
CertificateChainResponse certificateChainResponse = client.GetCertificateChain(new CertificateChainRequest($"{cert.certificate_id}"));
if (certificateChainResponse.Status == CertCentralBaseResponse.StatusType.SUCCESS)
{
if (certificateChainResponse.Intermediates == null || certificateChainResponse.Intermediates.Count == 0)
{
throw new Exception($"DigiCert returned an empty certificate chain for certificate {cert.certificate_id} on order {orderId}.");
}
certificate = certificateChainResponse.Intermediates[0].PEM;
}
else
Expand All @@ -1727,12 +1731,15 @@ private List<AnyCAPluginCertificate> GetAllConnectorCertsForOrder(string caReque
}
}
//Another check for duplicate PEMs to get arround issue with DigiCert API returning incorrect data sometimes on reissued/duplicate certs
if (pemList.Contains(certificate))
if (certificate != null && pemList.Contains(certificate))
{
_logger.LogWarning($"Found duplicate PEM for ID {caReqId}. Skipping...");
continue;
}
pemList.Add(certificate);
if (certificate != null)
{
pemList.Add(certificate);
}
var connCert = new AnyCAPluginCertificate
{
CARequestID = caReqId,
Expand Down