|
12 | 12 | using Keyfactor.Extensions.CAPlugin.CSCGlobal.Interfaces; |
13 | 13 | using Keyfactor.PKI.Enums.EJBCA; |
14 | 14 |
|
| 15 | +using Org.BouncyCastle.Bcpg; |
| 16 | + |
15 | 17 | namespace Keyfactor.Extensions.CAPlugin.CSCGlobal; |
16 | 18 |
|
17 | 19 | public class RequestManager |
18 | 20 | { |
19 | 21 | public static Func<string, string> Pemify = ss => |
20 | 22 | ss.Length <= 64 ? ss : ss.Substring(0, 64) + "\n" + Pemify(ss.Substring(64)); |
21 | 23 |
|
22 | | - private List<CustomField> GetCustomFields(EnrollmentProductInfo productInfo) |
| 24 | + private List<CustomField> GetCustomFields(EnrollmentProductInfo productInfo, List<GetCustomField> customFields) |
23 | 25 | { |
24 | 26 | var customFieldList = new List<CustomField>(); |
25 | 27 | foreach (var field in customFields) |
@@ -138,7 +140,7 @@ public DomainControlValidation GetDomainControlValidation(string methodType, str |
138 | 140 | } |
139 | 141 |
|
140 | 142 | public RegistrationRequest GetRegistrationRequest(EnrollmentProductInfo productInfo, string csr, |
141 | | - Dictionary<string, string[]> sans) |
| 143 | + Dictionary<string, string[]> sans, List<GetCustomField> customFields) |
142 | 144 | { |
143 | 145 | //var cert = "-----BEGIN CERTIFICATE REQUEST-----\r\n"; |
144 | 146 | var cert = Pemify(csr); |
@@ -166,7 +168,7 @@ public RegistrationRequest GetRegistrationRequest(EnrollmentProductInfo productI |
166 | 168 | OrganizationContact = productInfo.ProductParameters["Organization Contact"], |
167 | 169 | BusinessUnit = productInfo.ProductParameters["Business Unit"], |
168 | 170 | ShowPrice = true, //User should not have to fill this out |
169 | | - CustomFields = GetCustomFields(productInfo), |
| 171 | + CustomFields = GetCustomFields(productInfo, customFields), |
170 | 172 | SubjectAlternativeNames = certificateType == "2" ? GetSubjectAlternativeNames(productInfo, sans) : null, |
171 | 173 | EvCertificateDetails = certificateType == "3" ? GetEvCertificateDetails(productInfo) : null |
172 | 174 | }; |
@@ -212,7 +214,7 @@ public Notifications GetNotifications(EnrollmentProductInfo productInfo) |
212 | 214 | } |
213 | 215 |
|
214 | 216 | public RenewalRequest GetRenewalRequest(EnrollmentProductInfo productInfo, string uUId, string csr, |
215 | | - Dictionary<string, string[]> sans) |
| 217 | + Dictionary<string, string[]> sans, List<GetCustomField> customFields) |
216 | 218 | { |
217 | 219 | //var cert = "-----BEGIN CERTIFICATE REQUEST-----\r\n"; |
218 | 220 | var cert = Pemify(csr); |
@@ -241,7 +243,7 @@ public RenewalRequest GetRenewalRequest(EnrollmentProductInfo productInfo, strin |
241 | 243 | BusinessUnit = productInfo.ProductParameters["Business Unit"], |
242 | 244 | ShowPrice = true, |
243 | 245 | SubjectAlternativeNames = certificateType == "2" ? GetSubjectAlternativeNames(productInfo, sans) : null, |
244 | | - CustomFields = GetCustomFields(productInfo), |
| 246 | + CustomFields = GetCustomFields(productInfo, customFields), |
245 | 247 | EvCertificateDetails = certificateType == "3" ? GetEvCertificateDetails(productInfo) : null |
246 | 248 | }; |
247 | 249 | } |
@@ -270,7 +272,7 @@ private List<SubjectAlternativeName> GetSubjectAlternativeNames(EnrollmentProduc |
270 | 272 | } |
271 | 273 |
|
272 | 274 | public ReissueRequest GetReissueRequest(EnrollmentProductInfo productInfo, string uUId, string csr, |
273 | | - Dictionary<string, string[]> sans) |
| 275 | + Dictionary<string, string[]> sans, List<GetCustomField> customFields) |
274 | 276 | { |
275 | 277 | //var cert = "-----BEGIN CERTIFICATE REQUEST-----\r\n"; |
276 | 278 | var cert = Pemify(csr); |
@@ -299,7 +301,7 @@ public ReissueRequest GetReissueRequest(EnrollmentProductInfo productInfo, strin |
299 | 301 | BusinessUnit = productInfo.ProductParameters["Business Unit"], |
300 | 302 | ShowPrice = true, |
301 | 303 | SubjectAlternativeNames = certificateType == "2" ? GetSubjectAlternativeNames(productInfo, sans) : null, |
302 | | - CustomFields = GetCustomFields(productInfo), |
| 304 | + CustomFields = GetCustomFields(productInfo, customFields), |
303 | 305 | EvCertificateDetails = certificateType == "3" ? GetEvCertificateDetails(productInfo) : null |
304 | 306 | }; |
305 | 307 | } |
|
0 commit comments