Skip to content
Merged
Show file tree
Hide file tree
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
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
- 1.1.0
- Enabled Flag For Gateway
- Dual Build Support
- 1.0.0
- Conversion to REST Framework

8 changes: 6 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -146,13 +146,16 @@ Enrollment Format Specifications Located [here](https://pki-ws-rest.symauth.com/

2. On the server hosting the AnyCA Gateway REST, download and unzip the latest [Digicert Mpki Gateway AnyCA Gateway REST plugin](https://github.com/Keyfactor/digicert-mpki-caplugin/releases/latest) from GitHub.

3. Copy the unzipped directory (usually called `net6.0`) to the Extensions directory:
3. Copy the unzipped directory (usually called `net6.0` or `net8.0`) to the Extensions directory:


```shell
Depending on your AnyCA Gateway REST version, copy the unzipped directory to one of the following locations:
Program Files\Keyfactor\AnyCA Gateway\AnyGatewayREST\net6.0\Extensions
Program Files\Keyfactor\AnyCA Gateway\AnyGatewayREST\net8.0\Extensions
```

> The directory containing the Digicert Mpki Gateway AnyCA Gateway REST plugin DLLs (`net6.0`) can be named anything, as long as it is unique within the `Extensions` directory.
> The directory containing the Digicert Mpki Gateway AnyCA Gateway REST plugin DLLs (`net6.0` or `net8.0`) can be named anything, as long as it is unique within the `Extensions` directory.

4. Restart the AnyCA Gateway REST service.

Expand All @@ -175,6 +178,7 @@ Enrollment Format Specifications Located [here](https://pki-ws-rest.symauth.com/
* **ClientCertLocation** - Location on the Gateway Server File System of Client Certificate sample: C:\temp\myclientcert.pfx
* **ClientCertPassword** - Password for the SOAP Client Certificate.
* **EndpointAddress** - Endpoint address for SOAP Service sample: https://someurl/pki-ws/certificateManagementService.
* **Enabled** - Flag to Enable or Disable gateway functionality. Disabling is primarily used to allow creation of the CA prior to configuration information being available.

2. TODO Certificate Template Creation Step is a required section

Expand Down
3 changes: 2 additions & 1 deletion digicert-mpki-caplugin/Constants.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
namespace Keyfactor.Extensions.CAPlugin.DigicertMpki
namespace Keyfactor.Extensions.CAPlugin.DigicertMpki
{
public class Constants
{
Expand All @@ -13,5 +13,6 @@ public class Constants
public static string EmailConstName = "EmailConstName";
public static string UpnConstName = "UpnConstName";
public static string OuStartPoint = "OuStartPoint";
public static string Enabled = "Enabled";
}
}
29 changes: 28 additions & 1 deletion digicert-mpki-caplugin/DigicertMpkiCAPlugin.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
using DigicertMpkiSoap;
using DigicertMpkiSoap;
using Keyfactor.AnyGateway.DigicertMpki;
using Keyfactor.AnyGateway.DigicertMpki.Client.Models;
using Keyfactor.AnyGateway.Extensions;
Expand Down Expand Up @@ -43,6 +43,13 @@
_config = DeserializeConfig(configProvider.CAConnectionData);
_logger.MethodEntry();

if (!_config.Enabled)
{
_logger.LogWarning($"The CA is currently in the Disabled state. It must be Enabled to perform operations.");
_logger.MethodExit(LogLevel.Trace);
return;
}

_requestManager = new RequestManager(_logger, _config);
_client = new DigiCertSymClient(_config, _logger);

Expand Down Expand Up @@ -106,7 +113,7 @@
}
}

private async Task ProcessProductModel(string productModel, BlockingCollection<AnyCAPluginCertificate> blockingBuffer, CancellationToken cancelToken)

Check warning on line 116 in digicert-mpki-caplugin/DigicertMpkiCAPlugin.cs

View workflow job for this annotation

GitHub Actions / call-starter-workflow / call-generate-readme-workflow / Use private doctool action in public repository

This async method lacks 'await' operators and will run synchronously. Consider using the 'await' operator to await non-blocking API calls, or 'await Task.Run(...)' to do CPU-bound work on a background thread.

Check warning on line 116 in digicert-mpki-caplugin/DigicertMpkiCAPlugin.cs

View workflow job for this annotation

GitHub Actions / call-starter-workflow / call-generate-readme-workflow / Use private doctool action in public repository

This async method lacks 'await' operators and will run synchronously. Consider using the 'await' operator to await non-blocking API calls, or 'await Task.Run(...)' to do CPU-bound work on a background thread.

Check warning on line 116 in digicert-mpki-caplugin/DigicertMpkiCAPlugin.cs

View workflow job for this annotation

GitHub Actions / call-starter-workflow / call-generate-readme-workflow / Use private doctool action in public repository

This async method lacks 'await' operators and will run synchronously. Consider using the 'await' operator to await non-blocking API calls, or 'await Task.Run(...)' to do CPU-bound work on a background thread.

Check warning on line 116 in digicert-mpki-caplugin/DigicertMpkiCAPlugin.cs

View workflow job for this annotation

GitHub Actions / call-starter-workflow / call-dotnet-build-and-release-workflow / dotnet-build-and-release

This async method lacks 'await' operators and will run synchronously. Consider using the 'await' operator to await non-blocking API calls, or 'await Task.Run(...)' to do CPU-bound work on a background thread.

Check warning on line 116 in digicert-mpki-caplugin/DigicertMpkiCAPlugin.cs

View workflow job for this annotation

GitHub Actions / call-starter-workflow / call-dotnet-build-and-release-workflow / dotnet-build-and-release

This async method lacks 'await' operators and will run synchronously. Consider using the 'await' operator to await non-blocking API calls, or 'await Task.Run(...)' to do CPU-bound work on a background thread.

Check warning on line 116 in digicert-mpki-caplugin/DigicertMpkiCAPlugin.cs

View workflow job for this annotation

GitHub Actions / call-starter-workflow / call-dotnet-build-and-release-workflow / dotnet-build-and-release

This async method lacks 'await' operators and will run synchronously. Consider using the 'await' operator to await non-blocking API calls, or 'await Task.Run(...)' to do CPU-bound work on a background thread.

Check warning on line 116 in digicert-mpki-caplugin/DigicertMpkiCAPlugin.cs

View workflow job for this annotation

GitHub Actions / call-starter-workflow / call-dotnet-build-and-release-workflow / dotnet-build-and-release

This async method lacks 'await' operators and will run synchronously. Consider using the 'await' operator to await non-blocking API calls, or 'await Task.Run(...)' to do CPU-bound work on a background thread.

Check warning on line 116 in digicert-mpki-caplugin/DigicertMpkiCAPlugin.cs

View workflow job for this annotation

GitHub Actions / call-starter-workflow / call-dotnet-build-and-release-workflow / dotnet-build-and-release

This async method lacks 'await' operators and will run synchronously. Consider using the 'await' operator to await non-blocking API calls, or 'await Task.Run(...)' to do CPU-bound work on a background thread.

Check warning on line 116 in digicert-mpki-caplugin/DigicertMpkiCAPlugin.cs

View workflow job for this annotation

GitHub Actions / call-starter-workflow / call-dotnet-build-and-release-workflow / dotnet-build-and-release

This async method lacks 'await' operators and will run synchronously. Consider using the 'await' operator to await non-blocking API calls, or 'await Task.Run(...)' to do CPU-bound work on a background thread.
{
int pageCounter = 0;
const int pageSize = 50;
Expand Down Expand Up @@ -293,10 +300,23 @@
StatusMessage = $"Enrollment Failed: {errorMessage}"
};

public async Task Ping() => _logger.LogTrace("Ping successful.");

Check warning on line 303 in digicert-mpki-caplugin/DigicertMpkiCAPlugin.cs

View workflow job for this annotation

GitHub Actions / call-starter-workflow / call-generate-readme-workflow / Use private doctool action in public repository

This async method lacks 'await' operators and will run synchronously. Consider using the 'await' operator to await non-blocking API calls, or 'await Task.Run(...)' to do CPU-bound work on a background thread.

Check warning on line 303 in digicert-mpki-caplugin/DigicertMpkiCAPlugin.cs

View workflow job for this annotation

GitHub Actions / call-starter-workflow / call-generate-readme-workflow / Use private doctool action in public repository

This async method lacks 'await' operators and will run synchronously. Consider using the 'await' operator to await non-blocking API calls, or 'await Task.Run(...)' to do CPU-bound work on a background thread.

Check warning on line 303 in digicert-mpki-caplugin/DigicertMpkiCAPlugin.cs

View workflow job for this annotation

GitHub Actions / call-starter-workflow / call-generate-readme-workflow / Use private doctool action in public repository

This async method lacks 'await' operators and will run synchronously. Consider using the 'await' operator to await non-blocking API calls, or 'await Task.Run(...)' to do CPU-bound work on a background thread.

Check warning on line 303 in digicert-mpki-caplugin/DigicertMpkiCAPlugin.cs

View workflow job for this annotation

GitHub Actions / call-starter-workflow / call-dotnet-build-and-release-workflow / dotnet-build-and-release

This async method lacks 'await' operators and will run synchronously. Consider using the 'await' operator to await non-blocking API calls, or 'await Task.Run(...)' to do CPU-bound work on a background thread.

Check warning on line 303 in digicert-mpki-caplugin/DigicertMpkiCAPlugin.cs

View workflow job for this annotation

GitHub Actions / call-starter-workflow / call-dotnet-build-and-release-workflow / dotnet-build-and-release

This async method lacks 'await' operators and will run synchronously. Consider using the 'await' operator to await non-blocking API calls, or 'await Task.Run(...)' to do CPU-bound work on a background thread.

Check warning on line 303 in digicert-mpki-caplugin/DigicertMpkiCAPlugin.cs

View workflow job for this annotation

GitHub Actions / call-starter-workflow / call-dotnet-build-and-release-workflow / dotnet-build-and-release

This async method lacks 'await' operators and will run synchronously. Consider using the 'await' operator to await non-blocking API calls, or 'await Task.Run(...)' to do CPU-bound work on a background thread.

Check warning on line 303 in digicert-mpki-caplugin/DigicertMpkiCAPlugin.cs

View workflow job for this annotation

GitHub Actions / call-starter-workflow / call-dotnet-build-and-release-workflow / dotnet-build-and-release

This async method lacks 'await' operators and will run synchronously. Consider using the 'await' operator to await non-blocking API calls, or 'await Task.Run(...)' to do CPU-bound work on a background thread.

Check warning on line 303 in digicert-mpki-caplugin/DigicertMpkiCAPlugin.cs

View workflow job for this annotation

GitHub Actions / call-starter-workflow / call-dotnet-build-and-release-workflow / dotnet-build-and-release

This async method lacks 'await' operators and will run synchronously. Consider using the 'await' operator to await non-blocking API calls, or 'await Task.Run(...)' to do CPU-bound work on a background thread.

Check warning on line 303 in digicert-mpki-caplugin/DigicertMpkiCAPlugin.cs

View workflow job for this annotation

GitHub Actions / call-starter-workflow / call-dotnet-build-and-release-workflow / dotnet-build-and-release

This async method lacks 'await' operators and will run synchronously. Consider using the 'await' operator to await non-blocking API calls, or 'await Task.Run(...)' to do CPU-bound work on a background thread.

public async Task ValidateCAConnectionInfo(Dictionary<string, object> connectionInfo)

Check warning on line 305 in digicert-mpki-caplugin/DigicertMpkiCAPlugin.cs

View workflow job for this annotation

GitHub Actions / call-starter-workflow / call-generate-readme-workflow / Use private doctool action in public repository

This async method lacks 'await' operators and will run synchronously. Consider using the 'await' operator to await non-blocking API calls, or 'await Task.Run(...)' to do CPU-bound work on a background thread.

Check warning on line 305 in digicert-mpki-caplugin/DigicertMpkiCAPlugin.cs

View workflow job for this annotation

GitHub Actions / call-starter-workflow / call-generate-readme-workflow / Use private doctool action in public repository

This async method lacks 'await' operators and will run synchronously. Consider using the 'await' operator to await non-blocking API calls, or 'await Task.Run(...)' to do CPU-bound work on a background thread.

Check warning on line 305 in digicert-mpki-caplugin/DigicertMpkiCAPlugin.cs

View workflow job for this annotation

GitHub Actions / call-starter-workflow / call-dotnet-build-and-release-workflow / dotnet-build-and-release

This async method lacks 'await' operators and will run synchronously. Consider using the 'await' operator to await non-blocking API calls, or 'await Task.Run(...)' to do CPU-bound work on a background thread.

Check warning on line 305 in digicert-mpki-caplugin/DigicertMpkiCAPlugin.cs

View workflow job for this annotation

GitHub Actions / call-starter-workflow / call-dotnet-build-and-release-workflow / dotnet-build-and-release

This async method lacks 'await' operators and will run synchronously. Consider using the 'await' operator to await non-blocking API calls, or 'await Task.Run(...)' to do CPU-bound work on a background thread.

Check warning on line 305 in digicert-mpki-caplugin/DigicertMpkiCAPlugin.cs

View workflow job for this annotation

GitHub Actions / call-starter-workflow / call-dotnet-build-and-release-workflow / dotnet-build-and-release

This async method lacks 'await' operators and will run synchronously. Consider using the 'await' operator to await non-blocking API calls, or 'await Task.Run(...)' to do CPU-bound work on a background thread.

Check warning on line 305 in digicert-mpki-caplugin/DigicertMpkiCAPlugin.cs

View workflow job for this annotation

GitHub Actions / call-starter-workflow / call-dotnet-build-and-release-workflow / dotnet-build-and-release

This async method lacks 'await' operators and will run synchronously. Consider using the 'await' operator to await non-blocking API calls, or 'await Task.Run(...)' to do CPU-bound work on a background thread.

Check warning on line 305 in digicert-mpki-caplugin/DigicertMpkiCAPlugin.cs

View workflow job for this annotation

GitHub Actions / call-starter-workflow / call-dotnet-build-and-release-workflow / dotnet-build-and-release

This async method lacks 'await' operators and will run synchronously. Consider using the 'await' operator to await non-blocking API calls, or 'await Task.Run(...)' to do CPU-bound work on a background thread.

Check warning on line 305 in digicert-mpki-caplugin/DigicertMpkiCAPlugin.cs

View workflow job for this annotation

GitHub Actions / call-starter-workflow / call-dotnet-build-and-release-workflow / dotnet-build-and-release

This async method lacks 'await' operators and will run synchronously. Consider using the 'await' operator to await non-blocking API calls, or 'await Task.Run(...)' to do CPU-bound work on a background thread.
{
try
{
if (!(bool)connectionInfo[Constants.Enabled])
Copy link

Copilot AI Oct 15, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Direct cast to bool will throw InvalidCastException if the value is null or not a boolean type. Use safer casting like 'connectionInfo.TryGetValue(Constants.Enabled, out var enabledValue) && enabledValue is bool enabled && !enabled' or provide a default value with 'as bool? ?? true'.

Suggested change
if (!(bool)connectionInfo[Constants.Enabled])
if (connectionInfo.TryGetValue(Constants.Enabled, out var enabledValue) && enabledValue is bool enabled && !enabled)

Copilot uses AI. Check for mistakes.
{
_logger.LogWarning($"The CA is currently in the Disabled state. It must be Enabled to perform operations. Skipping validation...");
Comment on lines +309 to +311
Copy link

Copilot AI Oct 6, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Direct casting without null check could cause InvalidCastException if the Enabled key is missing or contains a non-boolean value. Consider using TryGetValue and safe casting.

Suggested change
if (!(bool)connectionInfo[Constants.Enabled])
{
_logger.LogWarning($"The CA is currently in the Disabled state. It must be Enabled to perform operations. Skipping validation...");
if (!connectionInfo.TryGetValue(Constants.Enabled, out object enabledObj) || !(enabledObj is bool enabled) || !enabled)
{
_logger.LogWarning($"The CA is currently in the Disabled state or the Enabled flag is missing/invalid. It must be Enabled to perform operations. Skipping validation...");

Copilot uses AI. Check for mistakes.
_logger.MethodExit(LogLevel.Trace);
return;
}
}
catch (Exception ex)
{
_logger.LogError($"Exception: {LogHandler.FlattenException(ex)}");
Copy link

Copilot AI Oct 6, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The catch block logs the exception but continues execution, which could lead to unexpected behavior. The method should either handle the missing Enabled key gracefully or rethrow the exception after logging.

Suggested change
_logger.LogError($"Exception: {LogHandler.FlattenException(ex)}");
_logger.LogError($"Exception: {LogHandler.FlattenException(ex)}");
throw;

Copilot uses AI. Check for mistakes.
Copy link

Copilot AI Oct 15, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The catch block logs the exception but doesn't handle it, allowing execution to continue to line 320 even when an exception occurs accessing connectionInfo[Constants.Enabled]. This could lead to unexpected behavior. Either rethrow the exception after logging, or ensure the validation logic at line 320 can handle the error state appropriately.

Suggested change
_logger.LogError($"Exception: {LogHandler.FlattenException(ex)}");
_logger.LogError($"Exception: {LogHandler.FlattenException(ex)}");
return;

Copilot uses AI. Check for mistakes.
}
List<string> errors = ValidateConnectionInfo(connectionInfo);
if (errors.Any())
ThrowValidationException(errors);
Expand Down Expand Up @@ -372,6 +392,13 @@
Hidden = false,
DefaultValue = "",
Type = "String"
},
[Constants.Enabled] = new PropertyConfigInfo()
{
Comments = "Flag to Enable or Disable gateway functionality. Disabling is primarily used to allow creation of the CA prior to configuration information being available.",
Hidden = false,
DefaultValue = true,
Type = "Boolean"
}
};
}
Expand Down
3 changes: 2 additions & 1 deletion digicert-mpki-caplugin/DigicertMpkiConfig.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
namespace Keyfactor.Extensions.CAPlugin.DigicertMpki
namespace Keyfactor.Extensions.CAPlugin.DigicertMpki
{
public class DigicertMpkiConfig
{
Expand All @@ -17,5 +17,6 @@ public DigicertMpkiConfig()
public string EmailConstName { get; set; }
public string UpnConstName { get; set; }
public int OuStartPoint { get; set; }
public bool Enabled { get; set; } = true;
}
}
2 changes: 1 addition & 1 deletion digicert-mpki-caplugin/digicert-mpki-caplugin.csproj
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFramework>net6.0</TargetFramework>
<TargetFrameworks>net6.0;net8.0</TargetFrameworks>
<RootNamespace>Keyfactor.Extensions.CAPlugin.DigicertMpki</RootNamespace>
<ImplicitUsings>disable</ImplicitUsings>
<Nullable>disable</Nullable>
Expand Down
9 changes: 7 additions & 2 deletions integration-manifest.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"$schema": "https://keyfactor.github.io/integration-manifest-schema.json",
"$schema": "https://keyfactor.github.io/v2/integration-manifest-schema.json",
"integration_type": "anyca-plugin",
"name": "Digicert Mpki AnyCA REST Gateway Plugin",
"status": "pilot",
Expand All @@ -8,7 +8,8 @@
"update_catalog": true,
"description": "Digicert Mpki plugin for the AnyCA REST Gateway framework",
"gateway_framework": "24.2.0",
"release_dir": "digicert-mpki-caplugin/bin/Release/net6.0",
"release_dir": "digicert-mpki-caplugin/bin/Release",
"release_project": "digicert-mpki-caplugin/digicert-mpki-caplugin.csproj",
"about": {
"carest": {
"ca_plugin_config": [
Expand All @@ -31,6 +32,10 @@
{
"name": "EndpointAddress",
"description": "Endpoint address for SOAP Service sample: https://someurl/pki-ws/certificateManagementService."
},
{
"name": "Enabled",
"description": "Flag to Enable or Disable gateway functionality. Disabling is primarily used to allow creation of the CA prior to configuration information being available."
}
],
"enrollment_config": [],
Expand Down
Loading