Skip to content

Commit 52eee75

Browse files
committed
fix for smime profile type
1 parent 01ed1b3 commit 52eee75

2 files changed

Lines changed: 15 additions & 9 deletions

File tree

digicert-certcentral-caplugin/CertCentralCAPlugin.cs

Lines changed: 12 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -600,7 +600,7 @@ public Dictionary<string, PropertyConfigInfo> GetTemplateParameterAnnotations()
600600
},
601601
[CertCentralConstants.Config.PROFILE_TYPE] = new PropertyConfigInfo()
602602
{
603-
Comments = "Optional for secure_email_* types, ignored otherwise. Valid values are: strict, multipurpose. Default value is strict.",
603+
Comments = "Optional for secure_email_* types, ignored otherwise. Valid values are: strict, multipurpose. Use 'multipurpose' if your cert includes any additional EKUs such as client auth. Default if not provided is dependent on product configuration within Digicert portal.",
604604
Hidden = false,
605605
DefaultValue = "strict",
606606
Type = "String"
@@ -1023,7 +1023,7 @@ public async Task ValidateProductInfo(EnrollmentProductInfo productInfo, Diction
10231023
detailsRequest.ContainerId = null;
10241024
if (connectionInfo.ContainsKey(CertCentralConstants.Config.DIVISION_ID))
10251025
{
1026-
string div = (string)connectionInfo[CertCentralConstants.Config.DIVISION_ID];
1026+
string div = connectionInfo[CertCentralConstants.Config.DIVISION_ID].ToString();
10271027
if (!string.IsNullOrWhiteSpace(div))
10281028
{
10291029
if (int.TryParse($"{div}", out int divId))
@@ -1680,9 +1680,10 @@ private EnrollmentResult EnrollForSmimeCert(string csr, string subject, Dictiona
16801680
}
16811681
}
16821682

1683+
string profile = null;
16831684
if (productInfo.ProductParameters.ContainsKey(CertCentralConstants.Config.PROFILE_TYPE))
16841685
{
1685-
string profile = productInfo.ProductParameters[CertCentralConstants.Config.PROFILE_TYPE].ToString();
1686+
profile = productInfo.ProductParameters[CertCentralConstants.Config.PROFILE_TYPE].ToString();
16861687

16871688
// Only validate if value provided
16881689
if (!string.IsNullOrEmpty(profile))
@@ -1693,6 +1694,10 @@ private EnrollmentResult EnrollForSmimeCert(string csr, string subject, Dictiona
16931694
throw new Exception($"Invalid profile type provided. Valid values are: strict, multipurpose");
16941695
}
16951696
}
1697+
else
1698+
{
1699+
profile = null;
1700+
}
16961701
}
16971702

16981703
if (cnIndic.Equals("given_name_surname", StringComparison.OrdinalIgnoreCase))
@@ -1884,12 +1889,11 @@ private EnrollmentResult EnrollForSmimeCert(string csr, string subject, Dictiona
18841889
orderRequest.Certificate.SignatureHash = certType.signatureAlgorithm;
18851890
orderRequest.Certificate.CACertID = caCertId;
18861891
orderRequest.SetOrganization(organizationId);
1887-
string profileType = "strict";
1888-
if (productInfo.ProductParameters.ContainsKey(Constants.Config.PROFILE_TYPE))
1892+
//If profile type is not provided, use the default on the digicert product configuration
1893+
if (!string.IsNullOrEmpty(profile))
18891894
{
1890-
profileType = productInfo.ProductParameters[Constants.Config.PROFILE_TYPE];
1891-
}
1892-
orderRequest.Certificate.ProfileType = profileType;
1895+
orderRequest.Certificate.ProfileType = profile;
1896+
}
18931897
orderRequest.Certificate.CommonNameIndicator = cnIndicator;
18941898
if (productInfo.ProductID.Equals("secure_email_sponsor", StringComparison.OrdinalIgnoreCase))
18951899
{

digicert-certcentral-caplugin/digicert-certcentral-caplugin.csproj

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,13 @@
1-
<Project Sdk="Microsoft.NET.Sdk">
1+
<Project Sdk="Microsoft.NET.Sdk">
22

33
<PropertyGroup>
44
<TargetFrameworks>net6.0;net8.0</TargetFrameworks>
55
<RootNamespace>Keyfactor.Extensions.CAPlugin.DigiCert</RootNamespace>
66
<ImplicitUsings>enable</ImplicitUsings>
77
<Nullable>disable</Nullable>
88
<AssemblyName>DigicertCAPlugin</AssemblyName>
9+
<AssemblyVersion>2.1.1</AssemblyVersion>
10+
<FileVersion>2.1.1</FileVersion>
911
</PropertyGroup>
1012

1113
<ItemGroup>

0 commit comments

Comments
 (0)