From b9d47a217206ee5980f03252b59d5934084275fd Mon Sep 17 00:00:00 2001 From: Peter Dettman Date: Thu, 5 Dec 2013 19:28:56 +0700 Subject: Add ECFieldElement.GetEncoded() method --- crypto/src/math/ec/ECFieldElement.cs | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) (limited to 'crypto/src/math/ec/ECFieldElement.cs') 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 -- cgit 1.4.1