summary refs log tree commit diff
path: root/crypto/test
diff options
context:
space:
mode:
authorRoy Basmacier <roy.basmacier@keyfactor.com>2022-07-11 14:24:48 -0400
committerRoy Basmacier <roy.basmacier@keyfactor.com>2022-07-11 14:24:48 -0400
commit141cf71f4b6ea7dbf709559b0a5fbf371856b86b (patch)
tree7ed004ac03fb4e722ca79da49bf998986f101632 /crypto/test
parentAdded SIKE to PrivateKeyFactory.cs and changed SikeVectorTest.cs (diff)
downloadBouncyCastle.NET-ed25519-141cf71f4b6ea7dbf709559b0a5fbf371856b86b.tar.xz
Detached picnic signature
Diffstat (limited to 'crypto/test')
-rw-r--r--crypto/test/src/pqc/crypto/test/PicnicVectorTest.cs18
1 files changed, 15 insertions, 3 deletions
diff --git a/crypto/test/src/pqc/crypto/test/PicnicVectorTest.cs b/crypto/test/src/pqc/crypto/test/PicnicVectorTest.cs
index 550a94c68..e8ca6b4fb 100644
--- a/crypto/test/src/pqc/crypto/test/PicnicVectorTest.cs
+++ b/crypto/test/src/pqc/crypto/test/PicnicVectorTest.cs
@@ -103,11 +103,23 @@ namespace Org.BouncyCastle.Pqc.Crypto.Tests
 
             signer.Init(true, privParams);
             byte[] sigGenerated = signer.GenerateSignature(msg);
-            Assert.True(smlen == sigGenerated.Length, name + " " + count + ": signature length");
+            byte[] attachedSig = Arrays.ConcatenateAll(UInt32_To_LE((uint)sigGenerated.Length), msg, sigGenerated);
+            
+            Assert.True(smlen == attachedSig.Length, name + " " + count + ": signature length");
 
             signer.Init(false, pubParams);
-            Assert.True(signer.VerifySignature(msg, sigGenerated), (name + " " + count + ": signature verify"));
-            Assert.True(Arrays.AreEqual(sigExpected, sigGenerated), name + " " + count + ": signature gen match");
+            Assert.True(signer.VerifySignature(msg, attachedSig), (name + " " + count + ": signature verify"));
+            Assert.True(Arrays.AreEqual(sigExpected, attachedSig), name + " " + count + ": signature gen match");
+        }
+
+        private static byte[] UInt32_To_LE(uint n)
+        {
+            byte[] bs = new byte[4];
+            bs[0] = (byte)(n);
+            bs[1] = (byte)(n >> 8);
+            bs[2] = (byte)(n >> 16);
+            bs[3] = (byte)(n >> 24);
+            return bs;
         }
 
         private static void RunTestVectorFile(string name)