diff options
author | Roy Basmacier <roy.basmacier@keyfactor.com> | 2022-07-11 14:24:48 -0400 |
---|---|---|
committer | Roy Basmacier <roy.basmacier@keyfactor.com> | 2022-07-11 14:24:48 -0400 |
commit | 141cf71f4b6ea7dbf709559b0a5fbf371856b86b (patch) | |
tree | 7ed004ac03fb4e722ca79da49bf998986f101632 /crypto/test | |
parent | Added SIKE to PrivateKeyFactory.cs and changed SikeVectorTest.cs (diff) | |
download | BouncyCastle.NET-ed25519-141cf71f4b6ea7dbf709559b0a5fbf371856b86b.tar.xz |
Detached picnic signature
Diffstat (limited to 'crypto/test')
-rw-r--r-- | crypto/test/src/pqc/crypto/test/PicnicVectorTest.cs | 18 |
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) |