Skip to content

Commit cf43fa4

Browse files
authored
Merge pull request #10 from Keyfactor/revocation
Revocation
2 parents e0b4f68 + 7287593 commit cf43fa4

3 files changed

Lines changed: 10 additions & 14 deletions

File tree

CHANGELOG.md

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,4 +3,7 @@ Inital Release. Support for Enroll, Sync, and Revocation.
33

44
1.0.1
55
Bugfix - sync records with null serial
6-
Bugfix - Fix for custom fields in enrollment
6+
Bugfix - Fix for custom fields in enrollment
7+
8+
1.0.2
9+
Handle change to Sectigo API Revocation call

sectigo-scm-caplugin/Client/SectigoClient.cs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -140,10 +140,11 @@ public async Task<List<Certificate>> PageCertificates(int position = 0, int size
140140
return await ProcessResponse<List<Certificate>>(response);
141141
}
142142

143-
public async Task<bool> RevokeSslCertificateById(int sslId, string revreason)
143+
public async Task<bool> RevokeSslCertificateById(int sslId, int revcode, string revreason)
144144
{
145145
JObject o = JObject.FromObject(new
146146
{
147+
reasonCode = revcode,
147148
reason = revreason
148149
});
149150
var response = await RestClient.PostAsJsonAsync($"api/ssl/v1/revoke/{sslId}", o);

sectigo-scm-caplugin/SectigoCAPlugin.cs

Lines changed: 4 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -462,7 +462,7 @@ public async Task<int> Revoke(string caRequestID, string hexSerialNumber, uint r
462462
try
463463
{
464464
var client = SectigoClient.InitializeClient(_config);
465-
var response = Task.Run(async () => await client.RevokeSslCertificateById(int.Parse(caRequestID), RevokeReasonToString(revocationReason))).Result;
465+
var response = Task.Run(async () => await client.RevokeSslCertificateById(int.Parse(caRequestID), (int)revocationReason, RevokeReasonToString(revocationReason))).Result;
466466

467467
_logger.MethodExit(LogLevel.Debug);
468468
if (response)//will throw an exception if false
@@ -874,26 +874,18 @@ public static string RevokeReasonToString(UInt32 revokeType)
874874
{
875875
switch (revokeType)
876876
{
877+
case 0:
878+
return "Unspecified";
877879
case 1:
878880
return "Compromised Key";
879-
880-
case 2:
881-
return "CA Compromised";
882-
883881
case 3:
884882
return "Affiliation Changed";
885-
886883
case 4:
887884
return "Superseded";
888-
889885
case 5:
890886
return "Cessation of Operation";
891-
892-
case 6:
893-
return "Certificate Hold";
894-
895887
default:
896-
return "Unspecified";
888+
throw new Exception($"Invalid revocation code: {revokeType.ToString()}. Valid values are 0,1,3-5");
897889
}
898890
}
899891
}

0 commit comments

Comments
 (0)