diff options
Diffstat (limited to 'crypto/test/src')
-rw-r--r-- | crypto/test/src/math/ec/rfc8032/test/Ed25519Test.cs | 36 |
1 files changed, 18 insertions, 18 deletions
diff --git a/crypto/test/src/math/ec/rfc8032/test/Ed25519Test.cs b/crypto/test/src/math/ec/rfc8032/test/Ed25519Test.cs index f2573903c..04b9c3cce 100644 --- a/crypto/test/src/math/ec/rfc8032/test/Ed25519Test.cs +++ b/crypto/test/src/math/ec/rfc8032/test/Ed25519Test.cs @@ -609,28 +609,28 @@ namespace Org.BouncyCastle.Math.EC.Rfc8032.Tests private static void ImplTamingVector(int number, bool expected, string msgHex, string pubHex, string sigHex) { - bool actual; - if (sigHex.Length > Ed25519.SignatureSize * 2) + bool actual = ImplTamingVector(msgHex, pubHex, sigHex); + + Assert.AreEqual(expected, actual, "Failed Taming EdDSA Vector #" + number); + } + + private static bool ImplTamingVector(string msgHex, string pubHex, string sigHex) + { + if (sigHex.Length != Ed25519.SignatureSize * 2) + return false; + + byte[] msg = Hex.DecodeStrict(msgHex); + byte[] pub = Hex.DecodeStrict(pubHex); + byte[] sig = Hex.DecodeStrict(sigHex); + + try { - actual = false; + return Ed25519.Verify(sig, 0, pub, 0, msg, 0, msg.Length); } - else + catch (Exception) { - byte[] msg = Hex.DecodeStrict(msgHex); - byte[] pub = Hex.DecodeStrict(pubHex); - byte[] sig = Hex.DecodeStrict(sigHex); - - try - { - actual = Ed25519.Verify(sig, 0, pub, 0, msg, 0, msg.Length); - } - catch (Exception) - { - actual = false; - } + return false; } - - Assert.AreEqual(expected, actual, "Failed Taming EdDSA Vector #" + number); } #endregion |