Skip to content

Commit 8392e61

Browse files
authored
Merge pull request #97 from Keyfactor/release-3.0
Merge 3.0.0 to main
2 parents 6ac5ce5 + 8daf5a0 commit 8392e61

File tree

87 files changed

+839
-625
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

87 files changed

+839
-625
lines changed

CHANGELOG.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,9 @@
1+
v3.0.0
2+
- Added support for post quantum ML-DSA certificates for store types RFPEM, RFJKS, RFPkcs12, and RFDER
3+
- Added support for On Device Key Generation (ODKG)
4+
- Removed FileTransferProtocol option from the config.json and store type custom fields. Integration will now always attempt SCP first and then SFTP (if SCP fails) for all file transfers.
5+
- Removed .net8/.net6 dual build capabilities. 3.0 and later releases .net8 only due to mandatory use of later Keyfactor libraries that have minimum requirements of .net8.
6+
17
v2.12.0
28
- Added config.json setting and its override store level custom field - AllowShellCommands. If "N" (default "Y"), SFTP will be used to create stores and move files on Linux-based certificate store servers. No Linux shell commands will be used in the integration.
39

README.md

Lines changed: 499 additions & 40 deletions
Large diffs are not rendered by default.

RemoteFile.UnitTests/ApplicationSettingsTests.cs

Lines changed: 0 additions & 19 deletions
This file was deleted.

RemoteFile.UnitTests/PropertyUtilitiesTests.cs

Lines changed: 0 additions & 48 deletions
This file was deleted.

RemoteFile.UnitTests/RemoteFile.UnitTests.csproj

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

33
<PropertyGroup>
4-
<TargetFramework>net6.0</TargetFramework>
4+
<TargetFramework>net8.0</TargetFramework>
55
<ImplicitUsings>enable</ImplicitUsings>
66
<Nullable>enable</Nullable>
77

88
<IsPackable>false</IsPackable>
99
</PropertyGroup>
1010

1111
<ItemGroup>
12-
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.1.0"/>
13-
<PackageReference Include="xunit" Version="2.4.1"/>
12+
<PackageReference Include="BouncyCastle.Cryptography" Version="2.6.2" />
13+
<PackageReference Include="Keyfactor.Orchestrators.IOrchestratorJobExtensions" Version="1.0.0" />
14+
<PackageReference Include="Keyfactor.PKI" Version="8.1.1" />
15+
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.1.0" />
16+
<PackageReference Include="xunit" Version="2.4.1" />
1417
<PackageReference Include="xunit.runner.visualstudio" Version="2.4.3">
1518
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
1619
<PrivateAssets>all</PrivateAssets>

RemoteFile/ApplicationSettings.cs

Lines changed: 0 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -19,13 +19,6 @@ namespace Keyfactor.Extensions.Orchestrator.RemoteFile
1919
{
2020
public class ApplicationSettings
2121
{
22-
public enum FileTransferProtocolEnum
23-
{
24-
SCP,
25-
SFTP,
26-
Both
27-
}
28-
2922
private const string DEFAULT_LINUX_PERMISSION_SETTING = "";
3023
private const string DEFAULT_OWNER_SETTING = "";
3124
private const string DEFAULT_SUDO_IMPERSONATION_SETTING = "";
@@ -40,7 +33,6 @@ public enum FileTransferProtocolEnum
4033
public static string DefaultLinuxPermissionsOnStoreCreation { get { return configuration.ContainsKey("DefaultLinuxPermissionsOnStoreCreation") ? configuration["DefaultLinuxPermissionsOnStoreCreation"] : DEFAULT_LINUX_PERMISSION_SETTING; } }
4134
public static string DefaultOwnerOnStoreCreation { get { return configuration.ContainsKey("DefaultOwnerOnStoreCreation") ? configuration["DefaultOwnerOnStoreCreation"] : DEFAULT_OWNER_SETTING; } }
4235
public static string DefaultSudoImpersonatedUser { get { return configuration.ContainsKey("DefaultSudoImpersonatedUser") ? configuration["DefaultSudoImpersonatedUser"] : DEFAULT_SUDO_IMPERSONATION_SETTING; } }
43-
public static bool CreateCSROnDevice { get { return configuration.ContainsKey("CreateCSROnDevice") ? configuration["CreateCSROnDevice"]?.ToUpper() == "Y" : false; } }
4436
public static string TempFilePathForODKG { get { return configuration.ContainsKey("TempFilePathForODKG") ? configuration["TempFilePathForODKG"] : string.Empty; } }
4537
public static bool UseShellCommands { get { return configuration.ContainsKey("UseShellCommands") ? configuration["UseShellCommands"]?.ToUpper() == "Y" : true; } }
4638
public static int SSHPort
@@ -61,34 +53,6 @@ public static int SSHPort
6153
}
6254
}
6355
}
64-
public static FileTransferProtocolEnum FileTransferProtocol
65-
{
66-
get
67-
{
68-
ILogger logger = LogHandler.GetClassLogger<ApplicationSettings>();
69-
70-
string protocolNames = string.Empty;
71-
foreach (string protocolName in Enum.GetNames(typeof(FileTransferProtocolEnum)))
72-
{
73-
protocolNames += protocolName + ", ";
74-
}
75-
protocolNames = protocolNames.Substring(0, protocolNames.Length - 2);
76-
string? protocolValue = configuration["FileTransferProtocol"];
77-
78-
if (!PropertyUtilities.TryEnumParse(protocolValue, out bool isFlagCombination, out FileTransferProtocolEnum protocol))
79-
throw new RemoteFileException($"Invalid optional config.json FileTransferProtocol option of {protocolValue}. If present, must be one of these values: {protocolNames}.");
80-
81-
// Issue: If received a comma-delimited list ("SCP,SFTP,Both"), it's treating it as a flag combination (i.e. mapping it to 0+1+2=3)
82-
// If this happens, we want to default it to Both so it's resolved as a valid mapping.
83-
if (isFlagCombination)
84-
{
85-
logger.LogWarning($"FileTransferProtocol config value {protocolValue} mapped to a flag combination. Setting FileTransferProtocol explicitly to Both.");
86-
protocol = FileTransferProtocolEnum.Both;
87-
}
88-
89-
return protocol;
90-
}
91-
}
9256

9357
static ApplicationSettings()
9458
{
@@ -143,8 +107,6 @@ private static void ValidateConfiguration(ILogger logger)
143107
logger.LogDebug($"Missing configuration parameter - DefaultLinuxPermissionsOnStoreCreation. Will set to default value of '{DEFAULT_LINUX_PERMISSION_SETTING}'");
144108
if (!configuration.ContainsKey("DefaultOwnerOnStoreCreation"))
145109
logger.LogDebug($"Missing configuration parameter - DefaultOwnerOnStoreCreation. Will set to default value of '{DEFAULT_OWNER_SETTING}'");
146-
if (!configuration.ContainsKey("FileTransferProtocol"))
147-
logger.LogDebug($"Missing configuration parameter - FileTransferProtocol. Will set to default value of 'SCP'");
148110
}
149111

150112
private static string AddTrailingSlash(string path)

RemoteFile/ImplementedStoreTypes/DER/DERCertificateStoreSerializer.cs

Lines changed: 10 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -5,24 +5,22 @@
55
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions
66
// and limitations under the License.
77

8-
using System;
9-
using System.Collections.Generic;
10-
using System.IO;
11-
using System.Linq;
12-
13-
using Newtonsoft.Json;
14-
8+
using Keyfactor.Extensions.Orchestrator.RemoteFile.Models;
9+
using Keyfactor.Extensions.Orchestrator.RemoteFile.RemoteHandlers;
1510
using Keyfactor.Logging;
11+
using Keyfactor.PKI.CryptographicObjects.Formatters;
1612
using Keyfactor.PKI.PrivateKeys;
1713
using Keyfactor.PKI.X509;
18-
using Keyfactor.Extensions.Orchestrator.RemoteFile.RemoteHandlers;
19-
using Keyfactor.Extensions.Orchestrator.RemoteFile.Models;
20-
2114
using Microsoft.Extensions.Logging;
22-
15+
using Newtonsoft.Json;
2316
using Org.BouncyCastle.Crypto;
2417
using Org.BouncyCastle.Pkcs;
18+
using Org.BouncyCastle.Tls;
2519
using Org.BouncyCastle.X509;
20+
using System;
21+
using System.Collections.Generic;
22+
using System.IO;
23+
using System.Linq;
2624

2725
namespace Keyfactor.Extensions.Orchestrator.RemoteFile.DER
2826
{
@@ -94,8 +92,7 @@ public List<SerializedStoreInfo> SerializeRemoteCertificateStore(Pkcs12Store cer
9492
throw new RemoteFileException($"DER certificate store has a private key at {SeparatePrivateKeyFilePath}, but no private key was passed with the certificate to this job.");
9593
}
9694

97-
CertificateConverter certConverter = CertificateConverterFactory.FromBouncyCastleCertificate(certificateStore.GetCertificate(alias).Certificate);
98-
certificateBytes = certConverter.ToDER(string.IsNullOrEmpty(storePassword) ? string.Empty : storePassword);
95+
certificateBytes = CryptographicObjectFormatter.DER.Format(certificateStore.GetCertificate(alias).Certificate);
9996

10097
if (!string.IsNullOrEmpty(SeparatePrivateKeyFilePath))
10198
{

0 commit comments

Comments
 (0)