summary refs log tree commit diff
path: root/crypto
diff options
context:
space:
mode:
authorPeter Dettman <peter.dettman@bouncycastle.org>2018-10-22 12:24:38 +0700
committerPeter Dettman <peter.dettman@bouncycastle.org>2018-10-22 12:24:38 +0700
commitb75ace683b656dbd5fd390557fb5800846822737 (patch)
tree4fccedc9160d6d64661f9629dd5f2cb55d5048e2 /crypto
parentDon't try to track unrecognized hash algorithms (diff)
downloadBouncyCastle.NET-ed25519-b75ace683b656dbd5fd390557fb5800846822737.tar.xz
Add GeneratePublicKey method for completeness
Diffstat (limited to 'crypto')
-rw-r--r--crypto/src/crypto/parameters/X25519PrivateKeyParameters.cs2
-rw-r--r--crypto/src/crypto/parameters/X448PrivateKeyParameters.cs2
-rw-r--r--crypto/src/math/ec/rfc7748/X25519.cs5
-rw-r--r--crypto/src/math/ec/rfc7748/X448.cs5
4 files changed, 12 insertions, 2 deletions
diff --git a/crypto/src/crypto/parameters/X25519PrivateKeyParameters.cs b/crypto/src/crypto/parameters/X25519PrivateKeyParameters.cs
index f7bbdac74..c9aaad949 100644
--- a/crypto/src/crypto/parameters/X25519PrivateKeyParameters.cs
+++ b/crypto/src/crypto/parameters/X25519PrivateKeyParameters.cs
@@ -48,7 +48,7 @@ namespace Org.BouncyCastle.Crypto.Parameters
         public X25519PublicKeyParameters GeneratePublicKey()
         {
             byte[] publicKey = new byte[X25519.PointSize];
-            X25519.ScalarMultBase(data, 0, publicKey, 0);
+            X25519.GeneratePublicKey(data, 0, publicKey, 0);
             return new X25519PublicKeyParameters(publicKey, 0);
         }
 
diff --git a/crypto/src/crypto/parameters/X448PrivateKeyParameters.cs b/crypto/src/crypto/parameters/X448PrivateKeyParameters.cs
index a073e5799..35eb1c4f7 100644
--- a/crypto/src/crypto/parameters/X448PrivateKeyParameters.cs
+++ b/crypto/src/crypto/parameters/X448PrivateKeyParameters.cs
@@ -48,7 +48,7 @@ namespace Org.BouncyCastle.Crypto.Parameters
         public X448PublicKeyParameters GeneratePublicKey()
         {
             byte[] publicKey = new byte[X448.PointSize];
-            X448.ScalarMultBase(data, 0, publicKey, 0);
+            X448.GeneratePublicKey(data, 0, publicKey, 0);
             return new X448PublicKeyParameters(publicKey, 0);
         }
 
diff --git a/crypto/src/math/ec/rfc7748/X25519.cs b/crypto/src/math/ec/rfc7748/X25519.cs
index 8524b9e2c..5c408ae42 100644
--- a/crypto/src/math/ec/rfc7748/X25519.cs
+++ b/crypto/src/math/ec/rfc7748/X25519.cs
@@ -60,6 +60,11 @@ namespace Org.BouncyCastle.Math.EC.Rfc7748
             k[ScalarSize - 1] |= 0x40;
         }
 
+        public static void GeneratePublicKey(byte[] k, int kOff, byte[] r, int rOff)
+        {
+            ScalarMultBase(k, kOff, r, rOff);
+        }
+
         private static void PointDouble(int[] x, int[] z)
         {
             int[] A = X25519Field.Create();
diff --git a/crypto/src/math/ec/rfc7748/X448.cs b/crypto/src/math/ec/rfc7748/X448.cs
index 63e526703..7ee0bdbd4 100644
--- a/crypto/src/math/ec/rfc7748/X448.cs
+++ b/crypto/src/math/ec/rfc7748/X448.cs
@@ -61,6 +61,11 @@ namespace Org.BouncyCastle.Math.EC.Rfc7748
             k[ScalarSize - 1] |= 0x80;
         }
 
+        public static void GeneratePublicKey(byte[] k, int kOff, byte[] r, int rOff)
+        {
+            ScalarMultBase(k, kOff, r, rOff);
+        }
+
         private static void PointDouble(uint[] x, uint[] z)
         {
             uint[] A = X448Field.Create();