From 33986f87aaa47d21fe877ec866f45d97035311cc Mon Sep 17 00:00:00 2001 From: idimov-keeper <78815270+idimov-keeper@users.noreply.github.com> Date: Mon, 22 Jan 2024 18:52:43 -0600 Subject: [PATCH 1/3] KSM-476 fixed parsing keys in DER format (#545) --- sdk/dotNet/SecretsManager/CryptoUtils.cs | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/sdk/dotNet/SecretsManager/CryptoUtils.cs b/sdk/dotNet/SecretsManager/CryptoUtils.cs index de7e6bb8..fbf5784c 100644 --- a/sdk/dotNet/SecretsManager/CryptoUtils.cs +++ b/sdk/dotNet/SecretsManager/CryptoUtils.cs @@ -15,6 +15,8 @@ using System.Security.Cryptography; using System.Text; using System.Text.RegularExpressions; +using Org.BouncyCastle.Asn1.Pkcs; +using Org.BouncyCastle.Asn1.Sec; namespace SecretsManager { @@ -105,8 +107,11 @@ private static ECPublicKeyParameters ImportPublicKey(byte[] key) } private static ECPrivateKeyParameters ImportPrivateKey(byte[] privateKeyDer) - { - return new ECPrivateKeyParameters(new BigInteger(1, privateKeyDer.Skip(36).Take(32).ToArray()), ECParameters); + { + var privateKeyInfo = PrivateKeyInfo.GetInstance(privateKeyDer); + var privateKeyStructure = ECPrivateKeyStructure.GetInstance(privateKeyInfo.ParsePrivateKey()); + var privateKeyValue = privateKeyStructure.GetKey(); + return new ECPrivateKeyParameters(privateKeyValue, ECParameters); } private static byte[] GetECIESSymmetricKey(ICipherParameters privateKey, ICipherParameters recipientPublicKey) From 9606b4b3923f3911947604588aa63b9788b82d72 Mon Sep 17 00:00:00 2001 From: idimov-keeper <78815270+idimov-keeper@users.noreply.github.com> Date: Mon, 22 Jan 2024 18:54:33 -0600 Subject: [PATCH 2/3] KSM-484 Upgraded all package dependencies to latest versions and switched from portable to the full version of Bouncy Castle (#553) --- .../SecretManagement.Keeper/SecretManagement.Keeper.csproj | 4 ++-- sdk/dotNet/SecretManagement.Keeper/build.ps1 | 2 +- sdk/dotNet/SecretsManager/SecretsManager.csproj | 6 +++--- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/sdk/dotNet/SecretManagement.Keeper/SecretManagement.Keeper.csproj b/sdk/dotNet/SecretManagement.Keeper/SecretManagement.Keeper.csproj index 6bdf4956..b1d1dcee 100644 --- a/sdk/dotNet/SecretManagement.Keeper/SecretManagement.Keeper.csproj +++ b/sdk/dotNet/SecretManagement.Keeper/SecretManagement.Keeper.csproj @@ -1,4 +1,4 @@ - + netstandard2.1 @@ -9,7 +9,7 @@ - + All diff --git a/sdk/dotNet/SecretManagement.Keeper/build.ps1 b/sdk/dotNet/SecretManagement.Keeper/build.ps1 index 290e72b7..f8b94d3e 100644 --- a/sdk/dotNet/SecretManagement.Keeper/build.ps1 +++ b/sdk/dotNet/SecretManagement.Keeper/build.ps1 @@ -30,7 +30,7 @@ if ($Package) { @( './bin/Release/netstandard2.1/SecretManagement.Keeper.dll' './bin/Release/netstandard2.1/SecretsManager.dll' - './bin/Release/netstandard2.1/BouncyCastle.Crypto.dll' + './bin/Release/netstandard2.1/BouncyCastle.Cryptography.dll' ) | ForEach-Object { Copy-Item -Path $_ -Destination $outDir -Force } diff --git a/sdk/dotNet/SecretsManager/SecretsManager.csproj b/sdk/dotNet/SecretsManager/SecretsManager.csproj index 93d49b19..b6014b2a 100644 --- a/sdk/dotNet/SecretsManager/SecretsManager.csproj +++ b/sdk/dotNet/SecretsManager/SecretsManager.csproj @@ -22,8 +22,8 @@ - - - + + + From 66d5e50c95b8f2670a6a28a4e5e0c9c075adf3d2 Mon Sep 17 00:00:00 2001 From: Max Ustinov Date: Tue, 23 Jan 2024 15:26:03 -0800 Subject: [PATCH 3/3] KSM .NET SDK Release v16.6.5 - bumping to version 16.6.5 - updating change log --- sdk/dotNet/README.md | 5 +++++ sdk/dotNet/SecretsManager/SecretsManager.csproj | 6 +++--- 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/sdk/dotNet/README.md b/sdk/dotNet/README.md index 2110d71c..20220ace 100644 --- a/sdk/dotNet/README.md +++ b/sdk/dotNet/README.md @@ -3,6 +3,11 @@ # Change Log +## 16.6.5 + +* KSM-476 - fix public key parsing +* KSM-484 - Update to latest Bouncy Castle version + ## 16.6.4 * KSM-466 - Fixed ExpiresOn conversion from UnixTimeMilliseconds. Closes [Issue #533] diff --git a/sdk/dotNet/SecretsManager/SecretsManager.csproj b/sdk/dotNet/SecretsManager/SecretsManager.csproj index b6014b2a..cc475f05 100644 --- a/sdk/dotNet/SecretsManager/SecretsManager.csproj +++ b/sdk/dotNet/SecretsManager/SecretsManager.csproj @@ -5,9 +5,9 @@ 9 Keeper Security Inc. SecretsManager .Net SDK - 16.6.4 - 16.6.4 - 16.6.4 + 16.6.5 + 16.6.5 + 16.6.5 en-US Keeper.SecretsManager Sergey Aldoukhov