From d955710c41babc0882e0c75c273452ba4f76c746 Mon Sep 17 00:00:00 2001
From: spbsoluble <1661003+spbsoluble@users.noreply.github.com>
Date: Wed, 18 Nov 2026 08:44:55 -0800
Subject: [PATCH 1/6] fix(sync): name SSL.com product codes so synced
certificates get a template
Accounts that issue through SSL.com list catalog codes 1011-1020 with
productTypeIDs 47-56. Sync named a code only through the emSign type IDs
(13-22), so SSL.com records kept the raw code and the gateway assigned no
template. SslComProductTypeIdsV2 maps the same product names to the SSL.com
types, and the sync name lookup reads both maps. Enrollment is unchanged.
---
CERTInext.Tests/SyncProductIdTests.cs | 49 ++++++++++++++++++++++++++-
CERTInext/CERTInextCAPlugin.cs | 7 ++--
CERTInext/Constants.cs | 22 ++++++++++++
CHANGELOG.md | 1 +
docsource/configuration.md | 2 +-
5 files changed, 76 insertions(+), 5 deletions(-)
diff --git a/CERTInext.Tests/SyncProductIdTests.cs b/CERTInext.Tests/SyncProductIdTests.cs
index 1c4ce21..d0a04f6 100644
--- a/CERTInext.Tests/SyncProductIdTests.cs
+++ b/CERTInext.Tests/SyncProductIdTests.cs
@@ -26,7 +26,7 @@ namespace Keyfactor.Extensions.CAPlugin.CERTInext.Tests
/// Issue 0097: the gateway gives a synced record a template only when its ProductID exactly equals a
/// template's ProductID, a product name from GetProductIds(). Both syncs must name the CERTInext product
/// code through the account catalog (code -> productTypeID -> name), and keep the code when they can't.
- /// Catalog values are the sandbox's (V1 and V2 identical, 2026-11-16).
+ /// Catalog values are the sandbox's (V1 and V2 identical, 2026-11-16), plus an SSL.com-category catalog.
///
[Collection(LoggingStateCollection.Name)]
public class SyncProductIdTests
@@ -40,12 +40,34 @@ public class SyncProductIdTests
new ProductDetail { ProductCode = "149", ProductTypeId = "39", Active = true }, // Intranet SSL (no plugin product)
};
+ // An account issuing through SSL.com: the "SSL.com" catalog category (2026-11-17).
+ private static List SslComCatalog() => new List
+ {
+ new ProductDetail { ProductCode = "1011", ProductTypeId = "47", Active = true }, // SSL.com DV SSL
+ new ProductDetail { ProductCode = "1012", ProductTypeId = "48", Active = true }, // SSL.com DV SSL Wildcard
+ new ProductDetail { ProductCode = "1013", ProductTypeId = "49", Active = true }, // SSL.com DV SSL UCC
+ new ProductDetail { ProductCode = "1014", ProductTypeId = "50", Active = true }, // SSL.com DV SSL Wildcard UCC
+ new ProductDetail { ProductCode = "1015", ProductTypeId = "51", Active = true }, // SSL.com OV SSL
+ new ProductDetail { ProductCode = "1020", ProductTypeId = "56", Active = true }, // SSL.com EV SSL UCC
+ new ProductDetail { ProductCode = "149", ProductTypeId = "39", Active = true }, // Intranet SSL (no plugin product)
+ };
+
[Theory]
[InlineData("13", Constants.Products.DvSsl)]
[InlineData("17", Constants.Products.OvSslWildcard)]
[InlineData("21", Constants.Products.DvSslWildcardUcc)]
[InlineData("20", Constants.Products.EvSslUcc)]
[InlineData(" 16 ", Constants.Products.OvSsl)]
+ [InlineData("47", Constants.Products.DvSsl)]
+ [InlineData("48", Constants.Products.DvSslWildcard)]
+ [InlineData("49", Constants.Products.DvSslUcc)]
+ [InlineData("50", Constants.Products.DvSslWildcardUcc)]
+ [InlineData("51", Constants.Products.OvSsl)]
+ [InlineData("52", Constants.Products.OvSslWildcard)]
+ [InlineData("53", Constants.Products.OvSslUcc)]
+ [InlineData("54", Constants.Products.OvSslWildcardUcc)]
+ [InlineData("55", Constants.Products.EvSsl)]
+ [InlineData("56", Constants.Products.EvSslUcc)]
[InlineData("39", null)]
[InlineData("", null)]
[InlineData(null, null)]
@@ -62,6 +84,8 @@ public void EveryAdvertisedProductHasATypeId_AndMapsBackToItself()
{
Constants.Products.ProductTypeIdsV2.Should().ContainKey(name);
CERTInextCAPlugin.ProductNameForTypeId(Constants.Products.ProductTypeIdsV2[name]).Should().Be(name);
+ Constants.Products.SslComProductTypeIdsV2.Should().ContainKey(name);
+ CERTInextCAPlugin.ProductNameForTypeId(Constants.Products.SslComProductTypeIdsV2[name]).Should().Be(name);
}
}
@@ -121,6 +145,29 @@ public async Task V2Sync_NamesProductCodesThroughTheCatalog_ReadOnce_KeepsUnknow
capture.Entries.Where(e => e.Level >= LogLevel.Warning).Should().BeEmpty();
}
+ [Fact]
+ public async Task V2Sync_SslComCatalog_NamesSslComProductCodes()
+ {
+ using var capture = new PluginLogCapture();
+ var (mock, plugin) = V2(IssuedRow("a", "1011"), IssuedRow("b", "1012"), IssuedRow("c", "1013"),
+ IssuedRow("d", "1020"), IssuedRow("e", "149"));
+ mock.Setup(c => c.GetProductDetailsV2Async(It.IsAny())).ReturnsAsync(SslComCatalog());
+ var buffer = new BlockingCollection(10);
+
+ await plugin.Synchronize(buffer, null, true, CancellationToken.None);
+
+ buffer.ToArray().ToDictionary(r => r.CARequestID, r => r.ProductID).Should().Equal(new Dictionary
+ {
+ ["a"] = Constants.Products.DvSsl,
+ ["b"] = Constants.Products.DvSslWildcard,
+ ["c"] = Constants.Products.DvSslUcc,
+ ["d"] = Constants.Products.EvSslUcc,
+ ["e"] = "149", // Private PKI: no plugin product of that type
+ });
+ capture.Lines(LogLevel.Information, "synchronization complete").Should().ContainSingle()
+ .Which.Should().Contain("ProductNames: Resolved=4, Unresolved=1");
+ }
+
[Fact]
public async Task V2Sync_CatalogFails_KeepsCodes_OneWarning_SyncCompletes()
{
diff --git a/CERTInext/CERTInextCAPlugin.cs b/CERTInext/CERTInextCAPlugin.cs
index 4c15046..05c61ec 100644
--- a/CERTInext/CERTInextCAPlugin.cs
+++ b/CERTInext/CERTInextCAPlugin.cs
@@ -421,10 +421,11 @@ public List GetProductIds()
};
}
- // Inverse of Constants.Products.ProductTypeIdsV2: catalog productTypeID -> the product name GetProductIds()
- // advertises (one name per type).
+ // Inverse of Constants.Products.ProductTypeIdsV2 (emSign types) and SslComProductTypeIdsV2 (SSL.com types):
+ // catalog productTypeID -> the product name GetProductIds() advertises (one name per type).
private static readonly Dictionary ProductNamesByTypeId =
- Constants.Products.ProductTypeIdsV2.ToDictionary(kv => kv.Value, kv => kv.Key, StringComparer.OrdinalIgnoreCase);
+ Constants.Products.ProductTypeIdsV2.Concat(Constants.Products.SslComProductTypeIdsV2)
+ .ToDictionary(kv => kv.Value, kv => kv.Key, StringComparer.OrdinalIgnoreCase);
///
/// The product name (one of ) for a catalog productTypeID, or null when the
diff --git a/CERTInext/Constants.cs b/CERTInext/Constants.cs
index d37100b..8665672 100644
--- a/CERTInext/Constants.cs
+++ b/CERTInext/Constants.cs
@@ -226,6 +226,28 @@ public static class Products
[EvSslUcc] = "20",
};
+ // V2-ONLY. The same product names mapped to the productTypeIDs of the "SSL.com" catalog
+ // category (codes 1011-1020), which accounts issuing through SSL.com list instead of the
+ // emSign types above. 47-50 match both the sandbox and a production-host catalog; 51-56
+ // match the sandbox catalog.
+ //
+ // Used only by Synchronize to name a synced order's product. Enrollment doesn't need it:
+ // UCC detection goes through ProductTypeIdsV2 by product name, never through the catalog.
+ public static readonly System.Collections.Generic.Dictionary SslComProductTypeIdsV2 =
+ new System.Collections.Generic.Dictionary(System.StringComparer.OrdinalIgnoreCase)
+ {
+ [DvSsl] = "47",
+ [DvSslWildcard] = "48",
+ [DvSslUcc] = "49",
+ [DvSslWildcardUcc] = "50",
+ [OvSsl] = "51",
+ [OvSslWildcard] = "52",
+ [OvSslUcc] = "53",
+ [OvSslWildcardUcc] = "54",
+ [EvSsl] = "55",
+ [EvSslUcc] = "56",
+ };
+
// V2-ONLY. Maps each SSL product name (ProductId) to the V2 create body's
// productVariant value ("dv"/"ov"/"ev"). Grouped by the same
// productTypeID assurance level ProductTypeIdsV2 above already documents (13-15 and
diff --git a/CHANGELOG.md b/CHANGELOG.md
index 6392f41..6c4e138 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -20,6 +20,7 @@
- feat(config): V2 orders honor `GroupNumber`, `OrganizationNumber`, `TechnicalContact*`, `EmailNotifications`, and the subscription renewal settings.
## Bug Fixes
+- fix(sync): Certificates synced from an account that issues through SSL.com (catalog codes `1011`-`1020`) get their product name, for example `DV SSL` or `DV SSL Multi-Domain (UCC)`, so the gateway assigns them the matching template. They used to keep the raw product code and get no template.
- fix(v2): A request whose CN is a plain name and whose SANs carry a wildcard (CN `example.com`, SAN `*.example.com`) is no longer rejected before ordering when the catalog has no single Wildcard UCC product. It keeps the CN as the domain and sends the wildcard in `additionalDomains`, with no `X-Product-Code` unless the template sets `ProductCode`.
- fix(v2): Extra SANs on an order with an explicit `ProductCode` are sent as `additionalDomains` instead of being rejected because the catalog lists the code as a single-domain product.
- fix(v2): Command's SAN list is the only source of an SSL order's extra names. A DNS name that is only in the CSR no longer makes the order multi-domain; the CSR is still sent unchanged, and its SANs are used only when the gateway passes no SAN list.
diff --git a/docsource/configuration.md b/docsource/configuration.md
index b8b8be8..7ef310e 100644
--- a/docsource/configuration.md
+++ b/docsource/configuration.md
@@ -513,7 +513,7 @@ Expired certificates are included in the V1 sync. `IgnoreExpired` has no effect
On V2, synchronization reads `/reports/orders` instead — see [V2 Order Lifecycle](#v2-order-lifecycle).
-**Templates for synced certificates (V1 and V2).** The gateway gives a synced certificate a template only when the record's product matches a configured template's product name (`DV SSL`, `OV SSL Wildcard`, …) exactly. CERTInext reports a product code instead, so each sync pass reads the account's product catalog once and names the code by its product type. On the sandbox, for example, `842` and `917` both become `DV SSL`, and `847` becomes `OV SSL Wildcard`. A certificate ordered outside Command, for example in the CERTInext portal, then arrives in Command with the first template configured for that product. A code with no matching plugin product (Private PKI, S/MIME, Document Signer) is passed on unchanged and gets no template, as before. If the catalog can't be read, the pass logs one warning and keeps the codes. The sync summary reports `ProductNames: Resolved=…, Unresolved=…`. Certificates enrolled through Command keep the template Command recorded at enrollment.
+**Templates for synced certificates (V1 and V2).** The gateway gives a synced certificate a template only when the record's product matches a configured template's product name (`DV SSL`, `OV SSL Wildcard`, …) exactly. CERTInext reports a product code instead, so each sync pass reads the account's product catalog once and names the code by its product type. On the sandbox, for example, `842` and `917` both become `DV SSL`, and `847` becomes `OV SSL Wildcard`. Accounts that issue through SSL.com list SSL.com codes instead (`1011`-`1020`, an "SSL.com" catalog category), and those are named the same way: `1011` becomes `DV SSL`, `1012` `DV SSL Wildcard`, and `1013` `DV SSL Multi-Domain (UCC)`. A certificate ordered outside Command, for example in the CERTInext portal, then arrives in Command with the first template configured for that product. A code with no matching plugin product (Private PKI, S/MIME, Document Signer) is passed on unchanged and gets no template, as before. If the catalog can't be read, the pass logs one warning and keeps the codes. The sync summary reports `ProductNames: Resolved=…, Unresolved=…`. Certificates enrolled through Command keep the template Command recorded at enrollment.
### Product Code Resolution
From 3b39777e828ab006f18baa217daf1d248c7b773b Mon Sep 17 00:00:00 2001
From: spbsoluble <1661003+spbsoluble@users.noreply.github.com>
Date: Wed, 18 Nov 2026 11:27:38 -0800
Subject: [PATCH 2/6] docs(sync): tighten SSL.com product-name notes; note
codes missing from the catalog
---
CERTInext/Constants.cs | 4 ++--
CHANGELOG.md | 2 +-
docsource/configuration.md | 2 +-
3 files changed, 4 insertions(+), 4 deletions(-)
diff --git a/CERTInext/Constants.cs b/CERTInext/Constants.cs
index 8665672..82387f1 100644
--- a/CERTInext/Constants.cs
+++ b/CERTInext/Constants.cs
@@ -228,8 +228,8 @@ public static class Products
// V2-ONLY. The same product names mapped to the productTypeIDs of the "SSL.com" catalog
// category (codes 1011-1020), which accounts issuing through SSL.com list instead of the
- // emSign types above. 47-50 match both the sandbox and a production-host catalog; 51-56
- // match the sandbox catalog.
+ // emSign types above. NOTE: 47-50 match two live catalogs; 51-56 (OV and EV) have been
+ // checked against one.
//
// Used only by Synchronize to name a synced order's product. Enrollment doesn't need it:
// UCC detection goes through ProductTypeIdsV2 by product name, never through the catalog.
diff --git a/CHANGELOG.md b/CHANGELOG.md
index 6c4e138..ab821c2 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -20,7 +20,7 @@
- feat(config): V2 orders honor `GroupNumber`, `OrganizationNumber`, `TechnicalContact*`, `EmailNotifications`, and the subscription renewal settings.
## Bug Fixes
-- fix(sync): Certificates synced from an account that issues through SSL.com (catalog codes `1011`-`1020`) get their product name, for example `DV SSL` or `DV SSL Multi-Domain (UCC)`, so the gateway assigns them the matching template. They used to keep the raw product code and get no template.
+- fix(sync): Certificates synced from an account that issues through SSL.com (product codes `1011`-`1020`) now get a product name such as `DV SSL`, so the gateway assigns the matching template. Before, they kept the raw code and got no template.
- fix(v2): A request whose CN is a plain name and whose SANs carry a wildcard (CN `example.com`, SAN `*.example.com`) is no longer rejected before ordering when the catalog has no single Wildcard UCC product. It keeps the CN as the domain and sends the wildcard in `additionalDomains`, with no `X-Product-Code` unless the template sets `ProductCode`.
- fix(v2): Extra SANs on an order with an explicit `ProductCode` are sent as `additionalDomains` instead of being rejected because the catalog lists the code as a single-domain product.
- fix(v2): Command's SAN list is the only source of an SSL order's extra names. A DNS name that is only in the CSR no longer makes the order multi-domain; the CSR is still sent unchanged, and its SANs are used only when the gateway passes no SAN list.
diff --git a/docsource/configuration.md b/docsource/configuration.md
index 7ef310e..8ef0cab 100644
--- a/docsource/configuration.md
+++ b/docsource/configuration.md
@@ -513,7 +513,7 @@ Expired certificates are included in the V1 sync. `IgnoreExpired` has no effect
On V2, synchronization reads `/reports/orders` instead — see [V2 Order Lifecycle](#v2-order-lifecycle).
-**Templates for synced certificates (V1 and V2).** The gateway gives a synced certificate a template only when the record's product matches a configured template's product name (`DV SSL`, `OV SSL Wildcard`, …) exactly. CERTInext reports a product code instead, so each sync pass reads the account's product catalog once and names the code by its product type. On the sandbox, for example, `842` and `917` both become `DV SSL`, and `847` becomes `OV SSL Wildcard`. Accounts that issue through SSL.com list SSL.com codes instead (`1011`-`1020`, an "SSL.com" catalog category), and those are named the same way: `1011` becomes `DV SSL`, `1012` `DV SSL Wildcard`, and `1013` `DV SSL Multi-Domain (UCC)`. A certificate ordered outside Command, for example in the CERTInext portal, then arrives in Command with the first template configured for that product. A code with no matching plugin product (Private PKI, S/MIME, Document Signer) is passed on unchanged and gets no template, as before. If the catalog can't be read, the pass logs one warning and keeps the codes. The sync summary reports `ProductNames: Resolved=…, Unresolved=…`. Certificates enrolled through Command keep the template Command recorded at enrollment.
+**Templates for synced certificates (V1 and V2).** The gateway gives a synced certificate a template only when the record's product matches a configured template's product name (`DV SSL`, `OV SSL Wildcard`, …) exactly. CERTInext reports a product code instead, so each sync pass reads the account's product catalog once and names the code by its product type. On the sandbox, for example, `842` and `917` both become `DV SSL`, and `847` becomes `OV SSL Wildcard`. Accounts that issue through SSL.com use codes `1011`-`1020` instead, which are named the same way (for example, `1013` becomes `DV SSL Multi-Domain (UCC)`). A certificate ordered outside Command, for example in the CERTInext portal, then arrives in Command with the first template configured for that product. A code with no matching plugin product (Private PKI, S/MIME, Document Signer), or one the account's catalog no longer lists (such as an older order's code), is passed on unchanged and gets no template. If the catalog can't be read, the pass logs one warning and keeps the codes. The sync summary reports `ProductNames: Resolved=…, Unresolved=…`. Certificates enrolled through Command keep the template Command recorded at enrollment.
### Product Code Resolution
From a8b6bf0c9a25725bd0f8fb22c0b6527be7330159 Mon Sep 17 00:00:00 2001
From: spbsoluble <1661003+spbsoluble@users.noreply.github.com>
Date: Wed, 18 Nov 2026 13:50:54 -0800
Subject: [PATCH 3/6] feat(logging): log the plugin version, DCV build flag and
target framework at Initialize
The plugin logged nothing that identifies the running build, and the gateway logs only
its own version, so a customer log couldn't say which release produced it. Initialize
now logs the assembly's informational version (as CI stamps it), whether the build
includes DCV support, and the target framework. The line is written before the
configuration is validated, so it is present even when Initialize throws.
---
CERTInext.Tests/PluginVersionLoggingTests.cs | 92 ++++++++++++++++++++
CERTInext/CERTInextCAPlugin.cs | 22 +++++
CHANGELOG.md | 1 +
3 files changed, 115 insertions(+)
create mode 100644 CERTInext.Tests/PluginVersionLoggingTests.cs
diff --git a/CERTInext.Tests/PluginVersionLoggingTests.cs b/CERTInext.Tests/PluginVersionLoggingTests.cs
new file mode 100644
index 0000000..e36bc39
--- /dev/null
+++ b/CERTInext.Tests/PluginVersionLoggingTests.cs
@@ -0,0 +1,92 @@
+// Copyright 2026 Keyfactor
+// Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0
+// Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions
+// and limitations under the License.
+
+using System;
+using System.Collections.Concurrent;
+using System.Collections.Generic;
+using System.Linq;
+using System.Reflection;
+using FluentAssertions;
+using Keyfactor.AnyGateway.Extensions;
+using Keyfactor.Logging;
+using Microsoft.Extensions.Logging;
+using Moq;
+using Xunit;
+
+namespace Keyfactor.Extensions.CAPlugin.CERTInext.Tests
+{
+ ///
+ /// Pins the "CERTInext CA plugin version" line logs, so a
+ /// customer log names the build that wrote it. Swaps the same way as
+ /// , so it runs in the shared logging collection.
+ ///
+ [Collection(LoggingStateCollection.Name)]
+ public class PluginVersionLoggingTests
+ {
+ private sealed class CapturingLoggerProvider : ILoggerProvider
+ {
+ public ConcurrentQueue Messages { get; } = new();
+ public ILogger CreateLogger(string categoryName) => new CapturingLogger(Messages);
+ public void Dispose() { }
+
+ private sealed class CapturingLogger : ILogger
+ {
+ private readonly ConcurrentQueue _messages;
+ public CapturingLogger(ConcurrentQueue messages) => _messages = messages;
+ public IDisposable BeginScope(TState state) => null;
+ public bool IsEnabled(LogLevel logLevel) => true;
+ public void Log(LogLevel logLevel, EventId eventId, TState state, Exception exception,
+ Func formatter)
+ => _messages.Enqueue(formatter(state, exception));
+ }
+ }
+
+ [Fact]
+ public void PluginVersion_IsTheAssemblyInformationalVersion()
+ {
+ string expected = typeof(CERTInextCAPlugin).Assembly
+ .GetCustomAttribute()?.InformationalVersion;
+
+ expected.Should().NotBeNullOrWhiteSpace("the SDK stamps an informational version on every build");
+ CERTInextCAPlugin.PluginVersion.Should().Be(expected);
+ CERTInextCAPlugin.PluginTargetFramework.Should().StartWith(".NETCoreApp,Version=v");
+ }
+
+ [Fact]
+ public void Initialize_LogsVersion_EvenWhenConfigValidationThrows()
+ {
+ var provider = new CapturingLoggerProvider();
+ var factory = LoggerFactory.Create(b => b.AddProvider(provider).SetMinimumLevel(LogLevel.Trace));
+ try
+ {
+ LogHandler.Factory = factory;
+
+ var configProvider = new Mock(MockBehavior.Strict);
+ // Cleartext, non-loopback ApiUrl: Initialize rejects it.
+ configProvider.Setup(p => p.CAConnectionData)
+ .Returns(new Dictionary { ["ApiUrl"] = "http://ca.example.com" });
+
+ // Constructed AFTER the factory swap so its _logger field resolves through it.
+ var plugin = new CERTInextCAPlugin();
+ Action act = () => plugin.Initialize(configProvider.Object, new Mock().Object);
+
+ act.Should().Throw();
+ }
+ finally
+ {
+ LogHandler.Factory = Microsoft.Extensions.Logging.Abstractions.NullLoggerFactory.Instance;
+ factory.Dispose();
+ }
+
+ string line = provider.Messages.FirstOrDefault(m => m.StartsWith("CERTInext CA plugin version "));
+ line.Should().NotBeNull("Initialize logs the version before it validates the config");
+ line.Should().Contain(CERTInextCAPlugin.PluginVersion);
+ line.Should().Contain($"DcvSupport={CERTInextCAPlugin.PluginDcvSupport}");
+ line.Should().Contain($"TargetFramework={CERTInextCAPlugin.PluginTargetFramework}");
+ }
+ }
+}
diff --git a/CERTInext/CERTInextCAPlugin.cs b/CERTInext/CERTInextCAPlugin.cs
index 05c61ec..ff00e61 100644
--- a/CERTInext/CERTInextCAPlugin.cs
+++ b/CERTInext/CERTInextCAPlugin.cs
@@ -9,6 +9,8 @@
using System.Collections.Concurrent;
using System.Collections.Generic;
using System.Linq;
+using System.Reflection;
+using System.Runtime.Versioning;
using System.Text.Json;
using System.Threading;
using System.Threading.Tasks;
@@ -35,6 +37,21 @@ public class CERTInextCAPlugin : IAnyCAPlugin, IDisposable
{
private readonly ILogger _logger = LogHandler.GetClassLogger();
+ // The version CI stamps on the build (+), logged at Initialize so a log names the build.
+ internal static readonly string PluginVersion =
+ typeof(CERTInextCAPlugin).Assembly.GetCustomAttribute()?.InformationalVersion
+ ?? typeof(CERTInextCAPlugin).Assembly.GetName().Version?.ToString()
+ ?? "unknown";
+
+ internal static readonly string PluginTargetFramework =
+ typeof(CERTInextCAPlugin).Assembly.GetCustomAttribute()?.FrameworkName ?? "unknown";
+
+#if SUPPORTS_DCV
+ internal const bool PluginDcvSupport = true;
+#else
+ internal const bool PluginDcvSupport = false;
+#endif
+
// 1 once the "Private PKI ignores V2InlineCsr" notice has been logged (once per plugin instance).
private int _loggedPrivatePkiIgnoresInlineCsr;
@@ -253,6 +270,11 @@ public void Initialize(IAnyCAPluginConfigProvider configProvider, ICertificateDa
{
_logger.MethodEntry(LogLevel.Debug);
+ // Before config validation, so the build is named even when Initialize throws.
+ _logger.LogInformation(
+ "CERTInext CA plugin version {Version}. DcvSupport={DcvSupport}, TargetFramework={TargetFramework}",
+ PluginVersion, PluginDcvSupport, PluginTargetFramework);
+
_certificateDataReader = certificateDataReader;
string rawConfig = JsonSerializer.Serialize(configProvider.CAConnectionData);
diff --git a/CHANGELOG.md b/CHANGELOG.md
index ab821c2..d58d06f 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -18,6 +18,7 @@
- feat(enroll): V2 orders also return a quickly issued certificate in the same `Enroll` call, using the `PickupRetries` and `PickupDelay` settings V1 gained in 1.0.1.
- feat(config): New settings `RequestorDesignation` and `V2SyncLookbackHours`.
- feat(config): V2 orders honor `GroupNumber`, `OrganizationNumber`, `TechnicalContact*`, `EmailNotifications`, and the subscription renewal settings.
+- feat(logging): Each time the gateway initializes the plugin, it logs the plugin's version, whether the build includes DCV support, and its target framework, for example `CERTInext CA plugin version 2.0.0+e8dafef5…. DcvSupport=True, TargetFramework=.NETCoreApp,Version=v8.0`. The line is written before the configuration is checked, so it appears even when initialization fails.
## Bug Fixes
- fix(sync): Certificates synced from an account that issues through SSL.com (product codes `1011`-`1020`) now get a product name such as `DV SSL`, so the gateway assigns the matching template. Before, they kept the raw code and got no template.
From 2b4d45fb985758e66c721931c9d1e534e9ac942d Mon Sep 17 00:00:00 2001
From: spbsoluble <1661003+spbsoluble@users.noreply.github.com>
Date: Wed, 18 Nov 2026 14:21:20 -0800
Subject: [PATCH 4/6] fix(v2): take the order's domain from the SANs when the
subject has no CN
A V2 SSL/TLS request with an empty subject (names only in the SANs) failed with
"Cannot determine primary domain" before any CA call. The V2 spec requires
certificate.domain but not a CSR CN, and CERTInext issues an empty-subject CSR with
CN = certificate.domain. When there is no CN, the domain is now the first DNS SAN
that isn't a wildcard, else the first wildcard one, from the same SAN source as
additionalDomains. A plain name comes first so that *.example.com + example.com is a
UCC order and keeps both names. Private PKI still requires a CN.
---
CERTInext.Tests/V2NoCnEnrollmentTests.cs | 153 +++++++++++++++++++++++
CERTInext/CERTInextCAPlugin.cs | 29 ++++-
CHANGELOG.md | 1 +
3 files changed, 182 insertions(+), 1 deletion(-)
create mode 100644 CERTInext.Tests/V2NoCnEnrollmentTests.cs
diff --git a/CERTInext.Tests/V2NoCnEnrollmentTests.cs b/CERTInext.Tests/V2NoCnEnrollmentTests.cs
new file mode 100644
index 0000000..6dd1190
--- /dev/null
+++ b/CERTInext.Tests/V2NoCnEnrollmentTests.cs
@@ -0,0 +1,153 @@
+// Copyright 2026 Keyfactor
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+
+using System;
+using System.Collections.Generic;
+using System.Threading;
+using System.Threading.Tasks;
+using FluentAssertions;
+using Keyfactor.AnyGateway.Extensions;
+using Keyfactor.Extensions.CAPlugin.CERTInext.API.V2;
+using Keyfactor.Extensions.CAPlugin.CERTInext.Client;
+using Moq;
+using Xunit;
+
+namespace Keyfactor.Extensions.CAPlugin.CERTInext.Tests
+{
+ ///
+ /// V2 SSL requests whose subject has no CN, with the names only in the SANs. The V2 spec requires
+ /// certificate.domain but not a CSR CN, so the plugin takes the domain from the SANs: the first
+ /// non-wildcard DNS name, else the first wildcard.
+ ///
+ public class V2NoCnEnrollmentTests
+ {
+ private static CERTInextCAPlugin BuildV2Plugin(ICERTInextClient client) =>
+ new CERTInextCAPlugin(client, new CERTInextConfig
+ {
+ UseV2Api = true,
+ ApiUrl = "https://v2.certinext.io",
+ OAuthClientId = "my-client",
+ OAuthClientSecret = "my-secret",
+ RequestorName = "Test User",
+ RequestorEmail = "test@example.com",
+ SignerPlace = "New York",
+ PickupRetries = 0
+ });
+
+ private static EnrollmentProductInfo DvProductInfo(string productId, string family = "ssl", string variant = null)
+ {
+ var parameters = new Dictionary(StringComparer.OrdinalIgnoreCase) { ["ProductFamily"] = family };
+ if (variant != null) parameters["ProductVariant"] = variant;
+ return new EnrollmentProductInfo { ProductID = productId, ProductParameters = parameters };
+ }
+
+ /// Runs Enroll with an empty subject and returns the create request sent to CERTInext.
+ private static async Task EnrollWithoutCnAsync(string[] dnsSans, string productId)
+ {
+ var mock = new Mock(MockBehavior.Loose);
+ V2CreateSslOrderRequest sent = null;
+ mock.Setup(c => c.PlaceOrderV2Async(
+ It.IsAny(), It.IsAny(),
+ It.IsAny(), It.IsAny()))
+ .Callback((_, _, r, _) => sent = r)
+ .ReturnsAsync(new V2CreateOrderResponse { OrderId = "ord_nocn_001", Status = "pending-dcv" });
+
+ await BuildV2Plugin(mock.Object).Enroll(
+ csr: MockCertificateData.FakeCsrPem,
+ subject: string.Empty,
+ san: new Dictionary { ["dnsname"] = dnsSans },
+ productInfo: DvProductInfo(productId),
+ requestFormat: RequestFormat.PKCS10,
+ enrollmentType: EnrollmentType.New);
+
+ sent.Should().NotBeNull("the order must be placed");
+ return sent;
+ }
+
+ [Fact]
+ public async Task Enroll_V2_NoCn_WildcardOnlySan_OrdersTheWildcard()
+ {
+ var sent = await EnrollWithoutCnAsync(new[] { "*.example.com" }, Constants.Products.DvSslWildcard);
+
+ sent.Certificate.Domain.Should().Be("*.example.com");
+ sent.Certificate.AdditionalDomains.Should().BeNullOrEmpty();
+ }
+
+ [Fact]
+ public async Task Enroll_V2_NoCn_WildcardFirstThenApex_OrdersTheApexWithTheWildcardAsExtra()
+ {
+ var sent = await EnrollWithoutCnAsync(new[] { "*.example.com", "example.com" }, Constants.Products.DvSsl);
+
+ sent.Certificate.Domain.Should().Be("example.com",
+ "a plain name is preferred, so both names are issued as with CN = example.com");
+ sent.Certificate.AdditionalDomains.Should().Equal("*.example.com");
+ }
+
+ [Fact]
+ public async Task Enroll_V2_NoCn_NoDnsSan_Throws()
+ {
+ var mock = new Mock(MockBehavior.Loose);
+
+ Func act = () => BuildV2Plugin(mock.Object).Enroll(
+ csr: MockCertificateData.FakeCsrPem,
+ subject: string.Empty,
+ san: new Dictionary(),
+ productInfo: DvProductInfo(Constants.Products.DvSsl),
+ requestFormat: RequestFormat.PKCS10,
+ enrollmentType: EnrollmentType.New);
+
+ await act.Should().ThrowAsync()
+ .WithMessage("Cannot determine primary domain for V2 order*DNS SAN*");
+ mock.Verify(c => c.PlaceOrderV2Async(
+ It.IsAny(), It.IsAny(),
+ It.IsAny(), It.IsAny()), Times.Never);
+ }
+
+ [Fact]
+ public async Task Enroll_V2_PrivatePki_NoCn_StillRequiresACn()
+ {
+ var mock = new Mock(MockBehavior.Loose);
+
+ Func act = () => BuildV2Plugin(mock.Object).Enroll(
+ csr: MockCertificateData.FakeCsrPem,
+ subject: string.Empty,
+ san: new Dictionary { ["dnsname"] = new[] { "host.example.local" } },
+ productInfo: DvProductInfo(Constants.Products.DvSsl, family: "private-pki", variant: "intranet-ssl"),
+ requestFormat: RequestFormat.PKCS10,
+ enrollmentType: EnrollmentType.New);
+
+ await act.Should().ThrowAsync()
+ .WithMessage("Cannot determine the primary hostname for V2 private-pki order*");
+ }
+
+ [Theory]
+ [InlineData(new[] { "*.example.com" }, "*.example.com")]
+ [InlineData(new[] { "*.example.com", "example.com" }, "example.com")]
+ [InlineData(new[] { "a.example.com", "b.example.com" }, "a.example.com")]
+ public void PrimaryDomainFromSans_PrefersAPlainName(string[] dnsSans, string expected)
+ {
+ CERTInextCAPlugin.PrimaryDomainFromSans(
+ new Dictionary { ["dnsname"] = dnsSans }, MockCertificateData.FakeCsrPem)
+ .Should().Be(expected);
+ }
+
+ [Fact]
+ public void PrimaryDomainFromSans_IgnoresNonDnsSans()
+ {
+ CERTInextCAPlugin.PrimaryDomainFromSans(
+ new Dictionary { ["ipaddress"] = new[] { "10.0.0.1" } }, MockCertificateData.FakeCsrPem)
+ .Should().BeNull();
+ }
+ }
+}
diff --git a/CERTInext/CERTInextCAPlugin.cs b/CERTInext/CERTInextCAPlugin.cs
index ff00e61..6e089a2 100644
--- a/CERTInext/CERTInextCAPlugin.cs
+++ b/CERTInext/CERTInextCAPlugin.cs
@@ -1728,6 +1728,23 @@ internal static List FindExtraDnsSans(
.ToList();
}
+ ///
+ /// The primary domain of a V2 SSL request whose subject has no CN: the first DNS SAN that isn't a
+ /// wildcard, else the first wildcard one, else null. Same SAN source as .
+ /// A plain name comes first so SANs *.example.com + example.com order like CN
+ /// example.com (a UCC order, both names issued); with a wildcard domain CERTInext issues only
+ /// the wildcard.
+ ///
+ internal static string PrimaryDomainFromSans(Dictionary san, string csr)
+ {
+ var dnsNames = CollectRequestedSanEntries(san, csr, out _, out _)
+ .Where(s => string.Equals(s.Type, "dns", StringComparison.OrdinalIgnoreCase))
+ .Select(s => s.Value)
+ .Where(v => !string.IsNullOrWhiteSpace(v))
+ .ToList();
+ return dnsNames.FirstOrDefault(v => !v.StartsWith("*.", StringComparison.Ordinal)) ?? dnsNames.FirstOrDefault();
+ }
+
///
/// Validates the template parameters a V2 private-pki order needs
/// beyond the SSL ones, before any CA call. Shared by (fail
@@ -2047,10 +2064,20 @@ private async Task EnrollV2CoreAsync(
string domain = ep.DomainName;
if (string.IsNullOrWhiteSpace(domain))
domain = ExtractCnFromSubject(subject);
+ // SSL with no CN (the names only in the SANs): the V2 spec requires certificate.domain, not a CSR
+ // CN, so take the domain from the SANs. CERTInext issues with CN = that domain.
+ if (string.IsNullOrWhiteSpace(domain) && !isPrivatePki)
+ {
+ domain = PrimaryDomainFromSans(san, csr);
+ if (!string.IsNullOrWhiteSpace(domain))
+ _logger.LogInformation(
+ "EnrollV2Async: the subject has no CN; the primary domain is taken from the SANs. Domain={Domain}",
+ LogSanitizer.Strip(domain));
+ }
if (string.IsNullOrWhiteSpace(domain))
throw new Exception(isPrivatePki
? "Cannot determine the primary hostname for V2 private-pki order — set the DomainName enrollment parameter or ensure the CSR subject has a CN."
- : "Cannot determine primary domain for V2 order — set the DomainName enrollment parameter or ensure the CSR subject has a CN.");
+ : "Cannot determine primary domain for V2 order — set the DomainName enrollment parameter, or give the CSR subject a CN or the request a DNS SAN.");
// organization is "Conditional — Mandatory for OV / EV" per the V2 spec's SSL field
// table; every OV/EV create example in the spec sends it, and it is omitted entirely
diff --git a/CHANGELOG.md b/CHANGELOG.md
index d58d06f..9d413dd 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -22,6 +22,7 @@
## Bug Fixes
- fix(sync): Certificates synced from an account that issues through SSL.com (product codes `1011`-`1020`) now get a product name such as `DV SSL`, so the gateway assigns the matching template. Before, they kept the raw code and got no template.
+- fix(v2): An SSL/TLS request whose subject has no CN, with its names only in the SANs, is no longer rejected. The order's domain is the first DNS SAN that isn't a wildcard, else the first wildcard one, and the other DNS SANs go in `additionalDomains` as usual. So SANs `*.example.com` alone order the wildcard, and SANs `*.example.com` + `example.com` order `example.com` with the wildcard as an additional domain, so the certificate gets both names. The issued certificate's CN is that domain. Private PKI still requires a CN.
- fix(v2): A request whose CN is a plain name and whose SANs carry a wildcard (CN `example.com`, SAN `*.example.com`) is no longer rejected before ordering when the catalog has no single Wildcard UCC product. It keeps the CN as the domain and sends the wildcard in `additionalDomains`, with no `X-Product-Code` unless the template sets `ProductCode`.
- fix(v2): Extra SANs on an order with an explicit `ProductCode` are sent as `additionalDomains` instead of being rejected because the catalog lists the code as a single-domain product.
- fix(v2): Command's SAN list is the only source of an SSL order's extra names. A DNS name that is only in the CSR no longer makes the order multi-domain; the CSR is still sent unchanged, and its SANs are used only when the gateway passes no SAN list.
From ef16b7740fb37c60588fd3a5b52d2f58c75a72cf Mon Sep 17 00:00:00 2001
From: spbsoluble <1661003+spbsoluble@users.noreply.github.com>
Date: Wed, 18 Nov 2026 14:38:35 -0800
Subject: [PATCH 5/6] docs(v2): say CERTInext, not the plugin, sets the CN on a
request without one; document the SAN fallback for DomainName
---
CHANGELOG.md | 2 +-
docsource/configuration.md | 2 +-
2 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/CHANGELOG.md b/CHANGELOG.md
index 9d413dd..e677ac2 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -22,7 +22,7 @@
## Bug Fixes
- fix(sync): Certificates synced from an account that issues through SSL.com (product codes `1011`-`1020`) now get a product name such as `DV SSL`, so the gateway assigns the matching template. Before, they kept the raw code and got no template.
-- fix(v2): An SSL/TLS request whose subject has no CN, with its names only in the SANs, is no longer rejected. The order's domain is the first DNS SAN that isn't a wildcard, else the first wildcard one, and the other DNS SANs go in `additionalDomains` as usual. So SANs `*.example.com` alone order the wildcard, and SANs `*.example.com` + `example.com` order `example.com` with the wildcard as an additional domain, so the certificate gets both names. The issued certificate's CN is that domain. Private PKI still requires a CN.
+- fix(v2): An SSL/TLS request whose subject has no CN, with its names only in the SANs, is no longer rejected. The order's domain is the first DNS SAN that isn't a wildcard, else the first wildcard one, and the other DNS SANs go in `additionalDomains` as usual. So SANs `*.example.com` alone order the wildcard, and SANs `*.example.com` + `example.com` order `example.com` with the wildcard as an additional domain, so the certificate gets both names. The CSR is sent unchanged; CERTInext sets the issued certificate's CN to the order's domain. Private PKI still requires a CN.
- fix(v2): A request whose CN is a plain name and whose SANs carry a wildcard (CN `example.com`, SAN `*.example.com`) is no longer rejected before ordering when the catalog has no single Wildcard UCC product. It keeps the CN as the domain and sends the wildcard in `additionalDomains`, with no `X-Product-Code` unless the template sets `ProductCode`.
- fix(v2): Extra SANs on an order with an explicit `ProductCode` are sent as `additionalDomains` instead of being rejected because the catalog lists the code as a single-domain product.
- fix(v2): Command's SAN list is the only source of an SSL order's extra names. A DNS name that is only in the CSR no longer makes the order multi-domain; the CSR is still sent unchanged, and its SANs are used only when the gateway passes no SAN list.
diff --git a/docsource/configuration.md b/docsource/configuration.md
index 8ef0cab..8a5d1e1 100644
--- a/docsource/configuration.md
+++ b/docsource/configuration.md
@@ -327,7 +327,7 @@ In the Keyfactor Command Management Portal, navigate to **Certificate Templates*
| `RequesterEmail` | Optional | String | Overrides the connector `RequestorEmail` for this template when non-blank. Never derived from the certificate subject. | `pki-admin@example.com` |
| `RenewalWindowDays` | Optional | Number | Number of days before certificate expiration within which a renewal is attempted instead of a reissue. On V2 it decides only whether `RenewOrReissue` uses the SSL/TLS reissue endpoint (outside the window) or places a new order (inside it). Default: `90`. | `90` |
| `KeyType` | Optional | String | Informational. The CSR decides the key algorithm. CERTInext accepts only RSA 2048/3072/4096 and ECC P-256/P-384. | `RSA2048`, `RSA3072`, `RSA4096`, `EC256`, `EC384` |
-| `DomainName` | Optional | String | V2 only: primary domain name for SSL/TLS orders (for Private PKI, the primary hostname). If omitted, the plugin uses the CSR subject `CN`. V1 always uses the CSR subject `CN`. | `example.com` |
+| `DomainName` | Optional | String | V2 only: primary domain name for SSL/TLS orders (for Private PKI, the primary hostname). If omitted, the plugin uses the CSR subject `CN`. For an SSL/TLS request with no `CN`, it uses the first DNS SAN that isn't a wildcard, else the first wildcard one, and CERTInext sets the issued certificate's `CN` to that domain. V1 always uses the CSR subject `CN`. | `example.com` |
| `SignerName` | Optional | String | Per-template override for the subscriber agreement signer name. When omitted, defaults to the connector-level `RequestorName` (V2: the requestor name). If no name resolves, V1 sends `Keyfactor Gateway` and logs a warning. | `Jane Smith` |
| `SignerPlace` | Optional | String | Per-template override for the subscriber agreement signer location. When omitted, defaults to the connector-level `SignerPlace`. If neither is set, V1 sends `Gateway` and logs a warning. | `Austin` |
| `SignerIp` | Optional (V1 only) | String | Per-template override for the subscriber agreement signer IP address. Ignored on V2. When omitted, defaults to the connector-level `SignerIp`. If neither is set, V1 sends `127.0.0.1` and logs a warning; a V1 value that is not an IP address is sent unchanged, with a warning. | `203.0.113.10` |
From 92b6b58744ab63e24ca5c78308e4c7dd0b98e565 Mon Sep 17 00:00:00 2001
From: "github-actions[bot]"
Date: Wed, 18 Nov 2026 22:39:10 +0000
Subject: [PATCH 6/6] docs: auto-generate README and documentation [skip ci]
---
README.md | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/README.md b/README.md
index 2391acb..da9784c 100644
--- a/README.md
+++ b/README.md
@@ -227,7 +227,7 @@ In the Keyfactor Command Management Portal, navigate to **Certificate Templates*
| `RequesterEmail` | Optional | String | Overrides the connector `RequestorEmail` for this template when non-blank. Never derived from the certificate subject. | `pki-admin@example.com` |
| `RenewalWindowDays` | Optional | Number | Number of days before certificate expiration within which a renewal is attempted instead of a reissue. On V2 it decides only whether `RenewOrReissue` uses the SSL/TLS reissue endpoint (outside the window) or places a new order (inside it). Default: `90`. | `90` |
| `KeyType` | Optional | String | Informational. The CSR decides the key algorithm. CERTInext accepts only RSA 2048/3072/4096 and ECC P-256/P-384. | `RSA2048`, `RSA3072`, `RSA4096`, `EC256`, `EC384` |
-| `DomainName` | Optional | String | V2 only: primary domain name for SSL/TLS orders (for Private PKI, the primary hostname). If omitted, the plugin uses the CSR subject `CN`. V1 always uses the CSR subject `CN`. | `example.com` |
+| `DomainName` | Optional | String | V2 only: primary domain name for SSL/TLS orders (for Private PKI, the primary hostname). If omitted, the plugin uses the CSR subject `CN`. For an SSL/TLS request with no `CN`, it uses the first DNS SAN that isn't a wildcard, else the first wildcard one, and CERTInext sets the issued certificate's `CN` to that domain. V1 always uses the CSR subject `CN`. | `example.com` |
| `SignerName` | Optional | String | Per-template override for the subscriber agreement signer name. When omitted, defaults to the connector-level `RequestorName` (V2: the requestor name). If no name resolves, V1 sends `Keyfactor Gateway` and logs a warning. | `Jane Smith` |
| `SignerPlace` | Optional | String | Per-template override for the subscriber agreement signer location. When omitted, defaults to the connector-level `SignerPlace`. If neither is set, V1 sends `Gateway` and logs a warning. | `Austin` |
| `SignerIp` | Optional (V1 only) | String | Per-template override for the subscriber agreement signer IP address. Ignored on V2. When omitted, defaults to the connector-level `SignerIp`. If neither is set, V1 sends `127.0.0.1` and logs a warning; a V1 value that is not an IP address is sent unchanged, with a warning. | `203.0.113.10` |