Skip to content

Commit 989f11e

Browse files
authored
Adding tests cases for 128/192GCM
1 parent 539c0f1 commit 989f11e

File tree

1 file changed

+26
-2
lines changed

1 file changed

+26
-2
lines changed

Mastercard.Developer.ClientEncryption.Tests/NetCore2/Encryption/JWE/GcmJweObjectTest.cs

Lines changed: 26 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,10 +12,34 @@ public class GcmJweObjectTest
1212
#if !NETCOREAPP3_1 && !NET5_0_OR_GREATER
1313
[ExpectedException(typeof(EncryptionException), "AES/GCM/NoPadding is unsupported on .NET Standard < 2.1")]
1414
#endif
15-
public void TestDecrypt_ShouldReturnDecryptedPayload_WhenPayloadIsGcmEncrypted()
15+
public void TestDecrypt_ShouldReturnDecryptedPayload_WhenPayloadIs256GcmEncrypted()
1616
{
1717
// GIVEN
18-
JweObject jweObject = TestUtils.GetTestGcmJweObject();
18+
JweObject jweObject = TestUtils.GetTest256GcmJweObject();
19+
20+
// WHEN
21+
string decryptedPayload = jweObject.Decrypt(TestUtils.GetTestJweConfigBuilder().Build());
22+
23+
// THEN
24+
Assert.AreEqual("{\"foo\":\"bar\"}", decryptedPayload);
25+
}
26+
27+
public void TestDecrypt_ShouldReturnDecryptedPayload_WhenPayloadIs192GcmEncrypted()
28+
{
29+
// GIVEN
30+
JweObject jweObject = TestUtils.GetTest192GcmJweObject();
31+
32+
// WHEN
33+
string decryptedPayload = jweObject.Decrypt(TestUtils.GetTestJweConfigBuilder().Build());
34+
35+
// THEN
36+
Assert.AreEqual("{\"foo\":\"bar\"}", decryptedPayload);
37+
}
38+
39+
public void TestDecrypt_ShouldReturnDecryptedPayload_WhenPayloadIs128GcmEncrypted()
40+
{
41+
// GIVEN
42+
JweObject jweObject = TestUtils.GetTest128GcmJweObject();
1943

2044
// WHEN
2145
string decryptedPayload = jweObject.Decrypt(TestUtils.GetTestJweConfigBuilder().Build());

0 commit comments

Comments
 (0)