Skip to content

Commit

Permalink
Merge pull request #21 from Mastercard/feature/add-encryption-key-fin…
Browse files Browse the repository at this point in the history
…gerprint-to-jwe

Adding ability to update encryption key fingerprint for JWE
  • Loading branch information
danny-gallagher authored Sep 26, 2023
2 parents 0a87f9a + 140ae56 commit 54a7fd2
Show file tree
Hide file tree
Showing 5 changed files with 22 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,15 @@ public JweConfigBuilder WithEncryptionCertificate(X509Certificate2 encryptionCer
{
_encryptionCertificate = encryptionCertificate;
return this;
}

/// <summary>
/// See: <see cref="EncryptionConfig.EncryptionCertificate"/>
/// </summary>
public JweConfigBuilder WithEncryptionKeyFingerprint(string encryptionKeyFingerprint)
{
_encryptionKeyFingerprint = encryptionKeyFingerprint;
return this;
}

/// <summary>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
<PropertyGroup>
<TargetFrameworks>netstandard1.3;netstandard2.1</TargetFrameworks>
<GeneratePackageOnBuild>true</GeneratePackageOnBuild>
<Version>1.6.0</Version>
<Version>1.7.0</Version>
<Product>Mastercard.Developer.ClientEncryption.Core</Product>
<Authors>Mastercard</Authors>
<Company>Mastercard</Company>
Expand All @@ -16,7 +16,7 @@
<SignAssembly>true</SignAssembly>
<AssemblyOriginatorKeyFile>../Identity.snk</AssemblyOriginatorKeyFile>
<AssemblyVersion>1.0.0.0</AssemblyVersion> <!-- Frozen -->
<FileVersion>1.6.0.0</FileVersion> <!-- Same version as the package version -->
<FileVersion>1.7.0.0</FileVersion> <!-- Same version as the package version -->
<DocumentationFile>Mastercard.Developer.ClientEncryption.Core.xml</DocumentationFile>
<IncludeSymbols>true</IncludeSymbols>
<SymbolPackageFormat>snupkg</SymbolPackageFormat>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
<PropertyGroup>
<TargetFramework>netstandard1.3</TargetFramework>
<GeneratePackageOnBuild>true</GeneratePackageOnBuild>
<Version>1.6.0</Version>
<Version>1.7.0</Version>
<Product>Mastercard.Developer.ClientEncryption.RestSharp</Product>
<Authors>Mastercard</Authors>
<Company>Mastercard</Company>
Expand All @@ -16,7 +16,7 @@
<SignAssembly>true</SignAssembly>
<AssemblyOriginatorKeyFile>../Identity.snk</AssemblyOriginatorKeyFile>
<AssemblyVersion>1.0.0.0</AssemblyVersion> <!-- Frozen -->
<FileVersion>1.6.0.0</FileVersion> <!-- Same version as the package version -->
<FileVersion>1.7.0.0</FileVersion> <!-- Same version as the package version -->
<DocumentationFile>Mastercard.Developer.ClientEncryption.RestSharp.xml</DocumentationFile>
<IncludeSymbols>true</IncludeSymbols>
<SymbolPackageFormat>snupkg</SymbolPackageFormat>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
<PropertyGroup>
<TargetFramework>netstandard2.0</TargetFramework>
<GeneratePackageOnBuild>true</GeneratePackageOnBuild>
<Version>1.6.0</Version>
<Version>1.7.0</Version>
<Product>Mastercard.Developer.ClientEncryption.RestSharpV2</Product>
<Authors>Mastercard</Authors>
<Company>Mastercard</Company>
Expand All @@ -16,7 +16,7 @@
<SignAssembly>true</SignAssembly>
<AssemblyOriginatorKeyFile>../Identity.snk</AssemblyOriginatorKeyFile>
<AssemblyVersion>1.0.0.0</AssemblyVersion> <!-- Frozen -->
<FileVersion>1.6.0.0</FileVersion> <!-- Same version as the package version -->
<FileVersion>1.7.0.0</FileVersion> <!-- Same version as the package version -->
<DocumentationFile>Mastercard.Developer.ClientEncryption.RestSharpV2.xml</DocumentationFile>
<IncludeSymbols>true</IncludeSymbols>
<SymbolPackageFormat>snupkg</SymbolPackageFormat>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Expand Down

0 comments on commit 54a7fd2

Please sign in to comment.