Skip to content

Commit

Permalink
ported unit tests to .net 4.0
Browse files Browse the repository at this point in the history
  • Loading branch information
dvsekhvalnov committed Nov 6, 2024
1 parent b9cf4dc commit 640e629
Showing 1 changed file with 22 additions and 0 deletions.
22 changes: 22 additions & 0 deletions UnitTestsNet40/SecurityVulnerabilitiesTest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,8 @@ namespace UnitTests
[TestFixture]
public class SecurityVulnerabilitiesTest
{
private static readonly byte[] aes128Key = new byte[] { 194, 164, 235, 6, 138, 248, 171, 239, 24, 216, 11, 22, 137, 199, 215, 133 };

[Test]
public void UnboundedPBKDF2Attack()
{
Expand Down Expand Up @@ -155,6 +157,26 @@ public void DeflateBomb()
{
Console.Out.WriteLine(e.ToString());
}
}

[Test]
public void TruncatedGcmAuthTag()
{
// given
string token = "eyJhbGciOiJkaXIiLCJlbmMiOiJBMTI4R0NNIn0..PEXf1goWOF0SZRe_.Zp3CHYq4ZqM3_opMIy25O50gmQzw_p-nCOiW2ROuQSv80-aD-78n8m103kgPRPCsOt7qrckDRGSDACOBZGr2WovzSC-dxIcW3EsPqtibueyh0p3FY43h-bcbhPzXBdjQPaNTCY0o26wcEV_4FzPYdE9_ngRFIUe_7Kby-E2CWYLFc5D9RO9TLGN5dpHL6l4SOGbNz8M0o4aQuyJv3BV1wj_KswqyVcKBHjm0eh6RmFhoERxWjvt5yeo83bzxTfReVWAxXw.AVLr7JE1r1uiUSLj";

try
{
// when decrypt token with trunated AES GCM tag, it should fail
Jose.JWT.Decode(token, aes128Key);
Assert.Fail("Should fail with IntegrityException");

}
catch (ArgumentException e)
{
Console.Out.WriteLine(e.ToString());
}
}

}
}

0 comments on commit 640e629

Please sign in to comment.