Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/quite/humla-spongycastle.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPeter Dettman <peter.dettman@bouncycastle.org>2013-09-27 13:51:08 +0400
committerPeter Dettman <peter.dettman@bouncycastle.org>2013-09-27 13:51:08 +0400
commitde54694106821ac9d1da12d40ed5ba82288ff4fb (patch)
treeee57c2162a70344b4d7b607a04c265e709d37287 /core/src/main/java/org/bouncycastle/math
parentc921fbecb4c8ef8dad70d278c1fed6e08cf66a61 (diff)
Use ECFieldElement.getEncoded() in place of X9IntegerConverter when we
have a field element already
Diffstat (limited to 'core/src/main/java/org/bouncycastle/math')
-rw-r--r--core/src/main/java/org/bouncycastle/math/ec/ECPoint.java10
1 files changed, 3 insertions, 7 deletions
diff --git a/core/src/main/java/org/bouncycastle/math/ec/ECPoint.java b/core/src/main/java/org/bouncycastle/math/ec/ECPoint.java
index 1e1f2444..180beb95 100644
--- a/core/src/main/java/org/bouncycastle/math/ec/ECPoint.java
+++ b/core/src/main/java/org/bouncycastle/math/ec/ECPoint.java
@@ -43,8 +43,6 @@ public abstract class ECPoint
protected PreCompInfo preCompInfo = null;
- private static X9IntegerConverter converter = new X9IntegerConverter();
-
protected ECPoint(ECCurve curve, ECFieldElement x, ECFieldElement y)
{
this(curve, x, y, getInitialZCoords(curve));
@@ -256,10 +254,8 @@ public abstract class ECPoint
}
ECPoint normed = normalize();
- ECFieldElement x = normed.getAffineXCoord();
- int length = converter.getByteLength(x);
- byte[] X = converter.integerToBytes(x.toBigInteger(), length);
+ byte[] X = normed.getXCoord().getEncoded();
if (compressed)
{
@@ -269,8 +265,8 @@ public abstract class ECPoint
return PO;
}
- ECFieldElement y = normed.getAffineYCoord();
- byte[] Y = converter.integerToBytes(y.toBigInteger(), length);
+ byte[] Y = normed.getYCoord().getEncoded();
+
byte[] PO = new byte[X.length + Y.length + 1];
PO[0] = 0x04;
System.arraycopy(X, 0, PO, 1, X.length);