|
1 | | -using System; |
| 1 | +// Copyright 2022 Keyfactor |
| 2 | +// |
| 3 | +// Licensed under the Apache License, Version 2.0 (the "License"); |
| 4 | +// you may not use this file except in compliance with the License. |
| 5 | +// You may obtain a copy of the License at |
| 6 | +// |
| 7 | +// http://www.apache.org/licenses/LICENSE-2.0 |
| 8 | +// |
| 9 | +// Unless required by applicable law or agreed to in writing, software |
| 10 | +// distributed under the License is distributed on an "AS IS" BASIS, |
| 11 | +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 12 | +// See the License for the specific language governing permissions and |
| 13 | +// limitations under the License. |
| 14 | + |
| 15 | +using System; |
2 | 16 | using System.Collections.ObjectModel; |
3 | 17 | using System.Linq; |
4 | 18 | using System.Management.Automation; |
@@ -36,7 +50,6 @@ private string ResolvePamField(string name, string value) |
36 | 50 |
|
37 | 51 | public JobResult ProcessJob(ReenrollmentJobConfiguration config, SubmitReenrollmentCSR submitReEnrollmentUpdate) |
38 | 52 | { |
39 | | - _logger.MethodEntry(); |
40 | 53 | _logger = LogHandler.GetClassLogger<ReEnrollment>(); |
41 | 54 | _logger.LogTrace($"Job Configuration: {JsonConvert.SerializeObject(config)}"); |
42 | 55 | var storePath = JsonConvert.DeserializeObject<JobProperties>(config.CertificateStoreDetails.Properties, new JsonSerializerSettings { DefaultValueHandling = DefaultValueHandling.Populate }); |
@@ -105,13 +118,15 @@ private JobResult PerformReEnrollment(ReenrollmentJobConfiguration config, Submi |
105 | 118 | ps.AddScript($"Add-Content $infFilename 'KeyLength={keySize}'"); |
106 | 119 | ps.AddScript($"Add-Content $infFilename 'KeySpec = 0'"); |
107 | 120 |
|
108 | | - ps.AddScript($"Add-Content $infFilename '[Extensions]'"); |
109 | | - ps.AddScript(@"Add-Content $infFilename '2.5.29.17 = ""{text}""'"); |
110 | | - |
111 | | - // Todo: Parse SAN by '&' and add the below entry for each DSN |
112 | | - foreach (string s in SAN.ToString().Split("&")) |
| 121 | + if(SAN != null) |
113 | 122 | { |
114 | | - ps.AddScript($"Add-Content $infFilename '_continue_ = \"{s + "&"}\"'"); |
| 123 | + ps.AddScript($"Add-Content $infFilename '[Extensions]'"); |
| 124 | + ps.AddScript(@"Add-Content $infFilename '2.5.29.17 = ""{text}""'"); |
| 125 | + |
| 126 | + foreach (string s in SAN.ToString().Split("&")) |
| 127 | + { |
| 128 | + ps.AddScript($"Add-Content $infFilename '_continue_ = \"{s + "&"}\"'"); |
| 129 | + } |
115 | 130 | } |
116 | 131 |
|
117 | 132 | // Execute the -new command |
|
0 commit comments