Skip to content

Commit e083ee3

Browse files
authored
Merge pull request #5 from Keyfactor/nullserialsync
Nullserialsync
2 parents 3fa3c5e + 1f66b2a commit e083ee3

1 file changed

Lines changed: 19 additions & 14 deletions

File tree

sectigo-scm-caplugin/SectigoCAPlugin.cs

Lines changed: 19 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -190,7 +190,11 @@ public async Task<EnrollmentResult> Enroll(string csr, string subject, Dictionar
190190
case EnrollmentType.Reissue:
191191
case EnrollmentType.Renew:
192192
case EnrollmentType.RenewOrReissue:
193-
193+
string comment = "";
194+
if (productInfo.ProductParameters.ContainsKey("Keyfactor-Requester"))
195+
{
196+
comment = $"CERTIFICATE_REQUESTOR: {productInfo.ProductParameters["Keyfactor-Requester"]}";
197+
}
194198
EnrollRequest request = new EnrollRequest
195199
{
196200
csr = csr,
@@ -203,7 +207,7 @@ public async Task<EnrollmentResult> Enroll(string csr, string subject, Dictionar
203207
numberServers = 1,
204208
serverType = -1,
205209
subjAltNames = sanList,//,
206-
comments = $"CERTIFICATE_REQUESTOR: {productInfo.ProductParameters["Keyfactor-Requester"]}"//this is how the current gateway passes this data
210+
comments = comment
207211
};
208212

209213
_logger.LogDebug($"Submit {enrollmentType} request");
@@ -511,22 +515,23 @@ public async Task Synchronize(BlockingCollection<AnyCAPluginCertificate> blockin
511515
}
512516
}
513517

514-
//are we syncing a reissued cert?
515-
//Reissued certs keep the same ID, but may have different data and cause index errors on sync
516-
//Removed reissued certs from enrollment, but may be some stragglers for legacy installs
517-
int syncReqId = 0;
518-
if (dbCertId.Contains('-'))
519-
{
520-
syncReqId = int.Parse(dbCertId.Split('-')[0]);
521-
}
522-
else
523-
{
524-
syncReqId = int.Parse(dbCertId);
525-
}
526518

519+
int syncReqId = 0;
527520
string certData = string.Empty;
528521
if (!string.IsNullOrEmpty(dbCertId))
529522
{
523+
//are we syncing a reissued cert?
524+
//Reissued certs keep the same ID, but may have different data and cause index errors on sync
525+
//Removed reissued certs from enrollment, but may be some stragglers for legacy installs
526+
if (dbCertId.Contains('-'))
527+
{
528+
syncReqId = int.Parse(dbCertId.Split('-')[0]);
529+
}
530+
else
531+
{
532+
syncReqId = int.Parse(dbCertId);
533+
}
534+
530535
//we found an existing cert from the DB by serial number.
531536
//This should already be in the DB so no need to sync again unless status changes or
532537
//admin has forced a complete sync

0 commit comments

Comments
 (0)