Skip to content

Commit c3a719f

Browse files
authored
Merge pull request #37 from Keyfactor/dev-2.1
Dev 2.1
2 parents aceca2d + 509ad46 commit c3a719f

4 files changed

Lines changed: 25 additions & 12 deletions

File tree

CHANGELOG.md

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,4 +15,9 @@
1515
* Add configuration flag to support adding client auth EKU to ssl cert requests
1616
* NOTE: This is a temporary feature which is planned for loss of support by Digicert in May 2026
1717
* For smime certs, use profile type defined on the product as the default if not supplied, rather than just defaulting to 'strict'
18-
* Hotfix for data type conversion
18+
* Hotfix for data type conversion
19+
20+
### 2.1.2
21+
* Hotfix for incremental sync to default to a 6 day window if no previous incremental sync has run
22+
* Workaround for DigiCert API issue where retrieving the PEM data of multiple certificates in the same order can occasionally return duplicate data rather than the correct cert
23+
* Remove caching of product ID lookups from DigiCert account

digicert-certcentral-caplugin/CertCentralCAPlugin.cs

Lines changed: 16 additions & 2 deletions
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()
@@ -760,8 +760,14 @@ public async Task Synchronize(BlockingCollection<AnyCAPluginCertificate> blockin
760760
{
761761
_logger.MethodEntry(LogLevel.Trace);
762762

763-
lastSync = lastSync.HasValue ? lastSync.Value.AddHours(-7) : DateTime.MinValue; // DigiCert issue with treating the timezone as mountain time. -7 to accomodate DST
763+
// DigiCert issue with treating the timezone as mountain time. -7 hours to accomodate DST
764+
// If no last sync, use a 6 day window for the sync range (only relevant for incremental syncs)
765+
lastSync = lastSync.HasValue ? lastSync.Value.AddHours(-7) : DateTime.UtcNow.AddDays(-5);
764766
DateTime? utcDate = DateTime.UtcNow.AddDays(1);
767+
if ((utcDate.Value - lastSync.Value).Days > 6)
768+
{
769+
lastSync = DateTime.UtcNow.AddDays(-5);
770+
}
765771
string lastSyncFormat = FormatSyncDate(lastSync);
766772
string todaySyncFormat = FormatSyncDate(utcDate);
767773

@@ -1557,6 +1563,7 @@ private List<AnyCAPluginCertificate> GetAllConnectorCertsForOrder(string caReque
15571563
var orderCerts = GetAllCertsForOrder(orderId);
15581564

15591565
List<AnyCAPluginCertificate> certList = new List<AnyCAPluginCertificate>();
1566+
List<string> pemList = new List<string>();
15601567

15611568
foreach (var cert in orderCerts)
15621569
{
@@ -1578,6 +1585,13 @@ private List<AnyCAPluginCertificate> GetAllConnectorCertsForOrder(string caReque
15781585
throw new Exception($"Unexpected error downloading certificate {certId} for order {orderId}: {certificateChainResponse.Errors.FirstOrDefault()?.message}");
15791586
}
15801587
}
1588+
//Another check for duplicate PEMs to get arround issue with DigiCert API returning incorrect data sometimes on reissued/duplicate certs
1589+
if (pemList.Contains(certificate))
1590+
{
1591+
_logger.LogWarning($"Found duplicate PEM for ID {caReqId}. Skipping...");
1592+
continue;
1593+
}
1594+
pemList.Add(certificate);
15811595
var connCert = new AnyCAPluginCertificate
15821596
{
15831597
CARequestID = caReqId,

digicert-certcentral-caplugin/Models/CertCentralCertType.cs

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,6 @@ public class CertCentralCertType
1616
#region Private Fields
1717

1818
private static readonly ILogger Logger = LogHandler.GetClassLogger<CertCentralCertType>();
19-
private static List<CertCentralCertType> _allTypes;
2019

2120
#endregion Private Fields
2221

@@ -62,12 +61,7 @@ public class CertCentralCertType
6261
/// <returns></returns>
6362
public static List<CertCentralCertType> GetAllTypes(CertCentralConfig config)
6463
{
65-
if (_allTypes == null || !_allTypes.Any())
66-
{
67-
_allTypes = RetrieveCertCentralCertTypes(config);
68-
}
69-
70-
return _allTypes;
64+
return RetrieveCertCentralCertTypes(config);
7165
}
7266

7367
/// <summary>

digicert-certcentral-caplugin/digicert-certcentral-caplugin.csproj

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,8 @@
66
<ImplicitUsings>enable</ImplicitUsings>
77
<Nullable>disable</Nullable>
88
<AssemblyName>DigicertCAPlugin</AssemblyName>
9-
<AssemblyVersion>2.1.1</AssemblyVersion>
10-
<FileVersion>2.1.1</FileVersion>
9+
<AssemblyVersion>2.1.2</AssemblyVersion>
10+
<FileVersion>2.1.2</FileVersion>
1111
</PropertyGroup>
1212

1313
<ItemGroup>

0 commit comments

Comments
 (0)