Skip to content

Commit

Permalink
REL-4359 - KSM .NET SDK v16.6.5 (#560)
Browse files Browse the repository at this point in the history
* KSM-476 fixed parsing keys in DER format (#545)

* KSM-484 Upgraded all package dependencies to latest versions and switched from portable to the full version of Bouncy Castle (#553)
  • Loading branch information
maksimu authored Jan 23, 2024
1 parent 9b19035 commit e10b406
Show file tree
Hide file tree
Showing 5 changed files with 21 additions and 11 deletions.
5 changes: 5 additions & 0 deletions sdk/dotNet/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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]
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<Project Sdk="Microsoft.NET.Sdk">
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFramework>netstandard2.1</TargetFramework>
Expand All @@ -9,7 +9,7 @@
</PropertyGroup>

<ItemGroup>
<PackageReference Include="PowerShellStandard.Library" Version="5.1.0-preview-06">
<PackageReference Include="PowerShellStandard.Library" Version="5.1.1">
<PrivateAssets>All</PrivateAssets>
</PackageReference>
</ItemGroup>
Expand Down
2 changes: 1 addition & 1 deletion sdk/dotNet/SecretManagement.Keeper/build.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -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
}
Expand Down
9 changes: 7 additions & 2 deletions sdk/dotNet/SecretsManager/CryptoUtils.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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
{
Expand Down Expand Up @@ -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)
Expand Down
12 changes: 6 additions & 6 deletions sdk/dotNet/SecretsManager/SecretsManager.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,9 @@
<LangVersion>9</LangVersion>
<Company>Keeper Security Inc.</Company>
<Product>SecretsManager .Net SDK</Product>
<AssemblyVersion>16.6.4</AssemblyVersion>
<FileVersion>16.6.4</FileVersion>
<PackageVersion>16.6.4</PackageVersion>
<AssemblyVersion>16.6.5</AssemblyVersion>
<FileVersion>16.6.5</FileVersion>
<PackageVersion>16.6.5</PackageVersion>
<NeutralLanguage>en-US</NeutralLanguage>
<PackageId>Keeper.SecretsManager</PackageId>
<Authors>Sergey Aldoukhov</Authors>
Expand All @@ -22,8 +22,8 @@
</PropertyGroup>

<ItemGroup>
<PackageReference Include="Portable.BouncyCastle" Version="1.9.0" />
<PackageReference Include="System.Text.Json" Version="5.0.2" />
<PackageReference Include="System.Text.Encodings.Web" Version="5.0.1" />
<PackageReference Include="BouncyCastle.Cryptography" Version="2.2.1" />
<PackageReference Include="System.Text.Json" Version="8.0.0" />
<PackageReference Include="System.Text.Encodings.Web" Version="8.0.0" />
</ItemGroup>
</Project>

0 comments on commit e10b406

Please sign in to comment.