summary refs log tree commit diff
path: root/crypto/test
diff options
context:
space:
mode:
authorPeter Dettman <peter.dettman@bouncycastle.org>2024-03-13 20:11:36 +0700
committerPeter Dettman <peter.dettman@bouncycastle.org>2024-03-13 20:11:36 +0700
commit64439fc0cfd678f86faf741963c72fdef217ad5c (patch)
treed6d2c0075db1e16afc7ca4ebcf57531703f30803 /crypto/test
parentRefactoring in Cms (diff)
downloadBouncyCastle.NET-ed25519-64439fc0cfd678f86faf741963c72fdef217ad5c.tar.xz
Fix for EdDSA verification infinite loop
- see https://github.com/bcgit/bc-java/issues/1599
Diffstat (limited to 'crypto/test')
-rw-r--r--crypto/test/src/crypto/test/Ed25519Test.cs15
1 files changed, 15 insertions, 0 deletions
diff --git a/crypto/test/src/crypto/test/Ed25519Test.cs b/crypto/test/src/crypto/test/Ed25519Test.cs
index b604916de..88b06c32e 100644
--- a/crypto/test/src/crypto/test/Ed25519Test.cs
+++ b/crypto/test/src/crypto/test/Ed25519Test.cs
@@ -25,6 +25,21 @@ namespace Org.BouncyCastle.Crypto.Tests
         }
 
         [Test]
+        public void TestRegression_GitHub_bc_java_1599()
+        {
+            Ed25519PublicKeyParameters publicKey = new Ed25519PublicKeyParameters(
+                Hex.DecodeStrict("386e7cf7b9e8353933b07f1db8d84d3720bb667cbd811b312b4e338672338a6d"));
+            byte[] content = Hex.DecodeStrict("414141624c6743596c6f414141514943486e6a4a71326a75705455472d5a36694d716871313467414854486f64757677694844664f594a3230775f77426c6e35444a3953614e616353496835336b626e716e723965ef34c5");
+            byte[] sig = Hex.DecodeStrict("74dc43223fc21b9157e686a1446621a4640464b8ee4877ea7e3963cb5da8b21b9089241defdd7f36448ec4c76174af131994321da7e28483b3c2a7906947fa0f");
+
+            ISigner signer = new Ed25519Signer();
+            signer.Init(false, publicKey);
+            signer.BlockUpdate(content, 0, content.Length);
+            bool verified = signer.VerifySignature(sig);
+            Assert.True(verified);
+        }
+
+        [Test]
         public void TestFunction()
         {
             string resultText = Perform().ToString();