summary refs log tree commit diff
path: root/crypto/src/math/ec/ECFieldElement.cs
diff options
context:
space:
mode:
authorPeter Dettman <peter.dettman@bouncycastle.org>2013-12-05 19:28:56 +0700
committerPeter Dettman <peter.dettman@bouncycastle.org>2013-12-05 19:28:56 +0700
commitb9d47a217206ee5980f03252b59d5934084275fd (patch)
tree25a4b7996a2f7982dd0847d7d98b73c91aa3cb4d /crypto/src/math/ec/ECFieldElement.cs
parentAlways apply sign guard (diff)
downloadBouncyCastle.NET-ed25519-b9d47a217206ee5980f03252b59d5934084275fd.tar.xz
Add ECFieldElement.GetEncoded() method
Diffstat (limited to 'crypto/src/math/ec/ECFieldElement.cs')
-rw-r--r--crypto/src/math/ec/ECFieldElement.cs9
1 files changed, 7 insertions, 2 deletions
diff --git a/crypto/src/math/ec/ECFieldElement.cs b/crypto/src/math/ec/ECFieldElement.cs
index 5235c6c0e..1205cdbcb 100644
--- a/crypto/src/math/ec/ECFieldElement.cs
+++ b/crypto/src/math/ec/ECFieldElement.cs
@@ -33,7 +33,7 @@ namespace Org.BouncyCastle.Math.EC
 			return Equals(other);
 		}
 
-		protected bool Equals(
+		protected virtual bool Equals(
 			ECFieldElement other)
 		{
 			return ToBigInteger().Equals(other.ToBigInteger());
@@ -48,7 +48,12 @@ namespace Org.BouncyCastle.Math.EC
 		{
 			return this.ToBigInteger().ToString(2);
 		}
-	}
+
+        public virtual byte[] GetEncoded()
+        {
+            return BigIntegers.AsUnsignedByteArray((FieldSize + 7) / 8, ToBigInteger());
+        }
+    }
 
 	public class FpFieldElement
 		: ECFieldElement