summary refs log tree commit diff
diff options
context:
space:
mode:
authorPeter Dettman <peter.dettman@bouncycastle.org>2023-09-06 20:14:47 +0700
committerPeter Dettman <peter.dettman@bouncycastle.org>2023-09-06 20:14:47 +0700
commit0259e7792f79f85c09668c4476d77bf7af5d7089 (patch)
tree931b074aec2205145fbc19bfb7554f99fe4288b5
parentEdDSA: Minor verification optimization (diff)
downloadBouncyCastle.NET-ed25519-0259e7792f79f85c09668c4476d77bf7af5d7089.tar.xz
Use GeneratePrivateKey in tests
-rw-r--r--crypto/test/src/math/ec/rfc8032/test/Ed25519Test.cs10
-rw-r--r--crypto/test/src/math/ec/rfc8032/test/Ed448Test.cs8
2 files changed, 9 insertions, 9 deletions
diff --git a/crypto/test/src/math/ec/rfc8032/test/Ed25519Test.cs b/crypto/test/src/math/ec/rfc8032/test/Ed25519Test.cs
index e298ef2e1..75a5e3807 100644
--- a/crypto/test/src/math/ec/rfc8032/test/Ed25519Test.cs
+++ b/crypto/test/src/math/ec/rfc8032/test/Ed25519Test.cs
@@ -35,7 +35,7 @@ namespace Org.BouncyCastle.Math.EC.Rfc8032.Tests
 
             for (int i = 0; i < 10; ++i)
             {
-				Random.NextBytes(sk);
+                Ed25519.GeneratePrivateKey(Random, sk);
                 var publicPoint = Ed25519.GeneratePublicKey(sk, 0);
                 Ed25519.EncodePublicPoint(publicPoint, pk, 0);
 
@@ -94,7 +94,7 @@ namespace Org.BouncyCastle.Math.EC.Rfc8032.Tests
 
             for (int i = 0; i < 10; ++i)
             {
-                Random.NextBytes(sk);
+                Ed25519.GeneratePrivateKey(Random, sk);
                 var publicPoint = Ed25519.GeneratePublicKey(sk, 0);
                 Ed25519.EncodePublicPoint(publicPoint, pk, 0);
 
@@ -154,7 +154,7 @@ namespace Org.BouncyCastle.Math.EC.Rfc8032.Tests
 
             for (int i = 0; i < 10; ++i)
             {
-                Random.NextBytes(sk);
+                Ed25519.GeneratePrivateKey(Random, sk);
                 var publicPoint = Ed25519.GeneratePublicKey(sk, 0);
                 Ed25519.EncodePublicPoint(publicPoint, pk, 0);
 
@@ -443,7 +443,7 @@ namespace Org.BouncyCastle.Math.EC.Rfc8032.Tests
 
             for (int i = 0; i < 10; ++i)
             {
-                Random.NextBytes(sk);
+                Ed25519.GeneratePrivateKey(Random, sk);
                 Ed25519.GeneratePublicKey(sk, 0, pk, 0);
                 Assert.IsTrue(Ed25519.ValidatePublicKeyFull(pk, 0));
             }
@@ -499,7 +499,7 @@ namespace Org.BouncyCastle.Math.EC.Rfc8032.Tests
 
             for (int i = 0; i < 10; ++i)
             {
-                Random.NextBytes(sk);
+                Ed25519.GeneratePrivateKey(Random, sk);
                 Ed25519.GeneratePublicKey(sk, 0, pk, 0);
                 Assert.IsTrue(Ed25519.ValidatePublicKeyPartial(pk, 0));
             }
diff --git a/crypto/test/src/math/ec/rfc8032/test/Ed448Test.cs b/crypto/test/src/math/ec/rfc8032/test/Ed448Test.cs
index 406325951..89a8889b5 100644
--- a/crypto/test/src/math/ec/rfc8032/test/Ed448Test.cs
+++ b/crypto/test/src/math/ec/rfc8032/test/Ed448Test.cs
@@ -34,7 +34,7 @@ namespace Org.BouncyCastle.Math.EC.Rfc8032.Tests
 
             for (int i = 0; i < 10; ++i)
             {
-                Random.NextBytes(sk);
+                Ed448.GeneratePrivateKey(Random, sk);
                 var publicPoint = Ed448.GeneratePublicKey(sk, 0);
                 Ed448.EncodePublicPoint(publicPoint, pk, 0);
 
@@ -94,7 +94,7 @@ namespace Org.BouncyCastle.Math.EC.Rfc8032.Tests
 
             for (int i = 0; i < 10; ++i)
             {
-                Random.NextBytes(sk);
+                Ed448.GeneratePrivateKey(Random, sk);
                 var publicPoint = Ed448.GeneratePublicKey(sk, 0);
                 Ed448.EncodePublicPoint(publicPoint, pk, 0);
 
@@ -514,7 +514,7 @@ namespace Org.BouncyCastle.Math.EC.Rfc8032.Tests
 
             for (int i = 0; i < 10; ++i)
             {
-                Random.NextBytes(sk);
+                Ed448.GeneratePrivateKey(Random, sk);
                 Ed448.GeneratePublicKey(sk, 0, pk, 0);
                 Assert.IsTrue(Ed448.ValidatePublicKeyFull(pk, 0));
             }
@@ -568,7 +568,7 @@ namespace Org.BouncyCastle.Math.EC.Rfc8032.Tests
 
             for (int i = 0; i < 10; ++i)
             {
-                Random.NextBytes(sk);
+                Ed448.GeneratePrivateKey(Random, sk);
                 Ed448.GeneratePublicKey(sk, 0, pk, 0);
                 Assert.IsTrue(Ed448.ValidatePublicKeyPartial(pk, 0));
             }