Skip to content

Commit 640e629

Browse files
committed
ported unit tests to .net 4.0
1 parent b9cf4dc commit 640e629

File tree

1 file changed

+22
-0
lines changed

1 file changed

+22
-0
lines changed

UnitTestsNet40/SecurityVulnerabilitiesTest.cs

+22
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,8 @@ namespace UnitTests
1616
[TestFixture]
1717
public class SecurityVulnerabilitiesTest
1818
{
19+
private static readonly byte[] aes128Key = new byte[] { 194, 164, 235, 6, 138, 248, 171, 239, 24, 216, 11, 22, 137, 199, 215, 133 };
20+
1921
[Test]
2022
public void UnboundedPBKDF2Attack()
2123
{
@@ -155,6 +157,26 @@ public void DeflateBomb()
155157
{
156158
Console.Out.WriteLine(e.ToString());
157159
}
160+
}
161+
162+
[Test]
163+
public void TruncatedGcmAuthTag()
164+
{
165+
// given
166+
string token = "eyJhbGciOiJkaXIiLCJlbmMiOiJBMTI4R0NNIn0..PEXf1goWOF0SZRe_.Zp3CHYq4ZqM3_opMIy25O50gmQzw_p-nCOiW2ROuQSv80-aD-78n8m103kgPRPCsOt7qrckDRGSDACOBZGr2WovzSC-dxIcW3EsPqtibueyh0p3FY43h-bcbhPzXBdjQPaNTCY0o26wcEV_4FzPYdE9_ngRFIUe_7Kby-E2CWYLFc5D9RO9TLGN5dpHL6l4SOGbNz8M0o4aQuyJv3BV1wj_KswqyVcKBHjm0eh6RmFhoERxWjvt5yeo83bzxTfReVWAxXw.AVLr7JE1r1uiUSLj";
167+
168+
try
169+
{
170+
// when decrypt token with trunated AES GCM tag, it should fail
171+
Jose.JWT.Decode(token, aes128Key);
172+
Assert.Fail("Should fail with IntegrityException");
173+
174+
}
175+
catch (ArgumentException e)
176+
{
177+
Console.Out.WriteLine(e.ToString());
178+
}
158179
}
180+
159181
}
160182
}

0 commit comments

Comments
 (0)