From 140ae56260be05ad1ecf85fa3a764da12a5efd47 Mon Sep 17 00:00:00 2001 From: E069279 Date: Tue, 26 Sep 2023 14:38:35 +0100 Subject: [PATCH] - Adding ability to update encryption key fingerprint for JWE - Bumping version to 1.7.0 for release --- .../Encryption/JweConfigBuilder.cs | 9 +++++++++ .../Mastercard.Developer.ClientEncryption.Core.csproj | 4 ++-- ...astercard.Developer.ClientEncryption.RestSharp.csproj | 4 ++-- ...tercard.Developer.ClientEncryption.RestSharpV2.csproj | 4 ++-- .../NetCore2/Encryption/JweConfigBuilderTest.cs | 7 +++++++ 5 files changed, 22 insertions(+), 6 deletions(-) diff --git a/Mastercard.Developer.ClientEncryption.Core/Encryption/JweConfigBuilder.cs b/Mastercard.Developer.ClientEncryption.Core/Encryption/JweConfigBuilder.cs index bc6bb9e..1019287 100644 --- a/Mastercard.Developer.ClientEncryption.Core/Encryption/JweConfigBuilder.cs +++ b/Mastercard.Developer.ClientEncryption.Core/Encryption/JweConfigBuilder.cs @@ -24,6 +24,15 @@ public JweConfigBuilder WithEncryptionCertificate(X509Certificate2 encryptionCer { _encryptionCertificate = encryptionCertificate; return this; + } + + /// + /// See: + /// + public JweConfigBuilder WithEncryptionKeyFingerprint(string encryptionKeyFingerprint) + { + _encryptionKeyFingerprint = encryptionKeyFingerprint; + return this; } /// diff --git a/Mastercard.Developer.ClientEncryption.Core/Mastercard.Developer.ClientEncryption.Core.csproj b/Mastercard.Developer.ClientEncryption.Core/Mastercard.Developer.ClientEncryption.Core.csproj index 0e8af3d..24a06d6 100644 --- a/Mastercard.Developer.ClientEncryption.Core/Mastercard.Developer.ClientEncryption.Core.csproj +++ b/Mastercard.Developer.ClientEncryption.Core/Mastercard.Developer.ClientEncryption.Core.csproj @@ -3,7 +3,7 @@ netstandard1.3;netstandard2.1 true - 1.6.0 + 1.7.0 Mastercard.Developer.ClientEncryption.Core Mastercard Mastercard @@ -16,7 +16,7 @@ true ../Identity.snk 1.0.0.0 - 1.6.0.0 + 1.7.0.0 Mastercard.Developer.ClientEncryption.Core.xml true snupkg diff --git a/Mastercard.Developer.ClientEncryption.RestSharp/Mastercard.Developer.ClientEncryption.RestSharp.csproj b/Mastercard.Developer.ClientEncryption.RestSharp/Mastercard.Developer.ClientEncryption.RestSharp.csproj index 2088fbe..4825502 100644 --- a/Mastercard.Developer.ClientEncryption.RestSharp/Mastercard.Developer.ClientEncryption.RestSharp.csproj +++ b/Mastercard.Developer.ClientEncryption.RestSharp/Mastercard.Developer.ClientEncryption.RestSharp.csproj @@ -3,7 +3,7 @@ netstandard1.3 true - 1.6.0 + 1.7.0 Mastercard.Developer.ClientEncryption.RestSharp Mastercard Mastercard @@ -16,7 +16,7 @@ true ../Identity.snk 1.0.0.0 - 1.6.0.0 + 1.7.0.0 Mastercard.Developer.ClientEncryption.RestSharp.xml true snupkg diff --git a/Mastercard.Developer.ClientEncryption.RestSharpV2/Mastercard.Developer.ClientEncryption.RestSharpV2.csproj b/Mastercard.Developer.ClientEncryption.RestSharpV2/Mastercard.Developer.ClientEncryption.RestSharpV2.csproj index f2693f7..3371605 100644 --- a/Mastercard.Developer.ClientEncryption.RestSharpV2/Mastercard.Developer.ClientEncryption.RestSharpV2.csproj +++ b/Mastercard.Developer.ClientEncryption.RestSharpV2/Mastercard.Developer.ClientEncryption.RestSharpV2.csproj @@ -3,7 +3,7 @@ netstandard2.0 true - 1.6.0 + 1.7.0 Mastercard.Developer.ClientEncryption.RestSharpV2 Mastercard Mastercard @@ -16,7 +16,7 @@ true ../Identity.snk 1.0.0.0 - 1.6.0.0 + 1.7.0.0 Mastercard.Developer.ClientEncryption.RestSharpV2.xml true snupkg diff --git a/Mastercard.Developer.ClientEncryption.Tests/NetCore2/Encryption/JweConfigBuilderTest.cs b/Mastercard.Developer.ClientEncryption.Tests/NetCore2/Encryption/JweConfigBuilderTest.cs index 0e0a5e1..7a73a2e 100644 --- a/Mastercard.Developer.ClientEncryption.Tests/NetCore2/Encryption/JweConfigBuilderTest.cs +++ b/Mastercard.Developer.ClientEncryption.Tests/NetCore2/Encryption/JweConfigBuilderTest.cs @@ -44,6 +44,13 @@ public void TestBuild_ShouldComputeCertificateKeyFingerprint_WhenFingerprintNotS Assert.AreEqual("761b003c1eade3a5490e5000d37887baa5e6ec0e226c07706e599451fc032a79", config.EncryptionKeyFingerprint); } + [TestMethod] + public void TestBuild_ShouldUseEncryptionKeyFingerprint_WhenFingerprintIsSet() + { + EncryptionConfig config = TestUtils.GetTestJweConfigBuilder().WithEncryptionKeyFingerprint("this-is-a-test-fingerprint").Build(); + Assert.AreEqual("this-is-a-test-fingerprint", config.EncryptionKeyFingerprint); + } + [TestMethod] [ExpectedException(typeof(EncryptionException))] public void TestBuild_ShouldThrowEncryptionException_WhenInvalidEncryptionCertificate()