Skip to content

Commit 2e903d2

Browse files
authored
Merge pull request #6 from Keyfactor/dnsbug
Dnsbug
2 parents 9545626 + da525ed commit 2e903d2

2 files changed

Lines changed: 12 additions & 5 deletions

File tree

AcmeCaPlugin/AcmeCaPlugin.cs

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -321,10 +321,14 @@ private static string ExtractDomainFromSubject(string subject)
321321
if (string.IsNullOrWhiteSpace(subject))
322322
throw new ArgumentException("Subject cannot be null or empty", nameof(subject));
323323

324-
return subject
325-
.Replace("CN=", "", StringComparison.OrdinalIgnoreCase)
326-
.Replace("cn=", "", StringComparison.OrdinalIgnoreCase)
327-
.Trim();
324+
// Match CN=value (capturing everything until comma or end of string)
325+
var match = Regex.Match(subject, @"CN=([^,]+)", RegexOptions.IgnoreCase);
326+
if (match.Success)
327+
{
328+
return match.Groups[1].Value.Trim();
329+
}
330+
331+
throw new ArgumentException($"Could not extract CN from subject: {subject}", nameof(subject));
328332
}
329333

330334
/// <summary>

CHANGELOG.md

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,7 @@
1-
# v1.0.1
1+
# v1.0.2
2+
* Fix DNS issue when fields outside domain are in the subject
3+
4+
# v1.0.1
25
* Added build for `.net8`
36

47
# v1.0.0

0 commit comments

Comments
 (0)