diff options
author | Peter Dettman <peter.dettman@bouncycastle.org> | 2013-09-23 18:05:05 +0400 |
---|---|---|
committer | Peter Dettman <peter.dettman@bouncycastle.org> | 2013-09-23 18:05:05 +0400 |
commit | 272398d61616ab54dfcbc7ecc6409bd565f3076b (patch) | |
tree | 9d9f0aa602d467f7774a16ceb196870437e8852a /core/src/main/java/org/bouncycastle/crypto/kems/ECIESKeyEncapsulation.java | |
parent | c8f6229673823b664f2c244966b7087b0f15cca1 (diff) |
Update various EC algorithms and tests to use normalize and
getAffine[XY]Coord when working with curves that might now be using
non-affine coordinates internally
Diffstat (limited to 'core/src/main/java/org/bouncycastle/crypto/kems/ECIESKeyEncapsulation.java')
-rwxr-xr-x | core/src/main/java/org/bouncycastle/crypto/kems/ECIESKeyEncapsulation.java | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/core/src/main/java/org/bouncycastle/crypto/kems/ECIESKeyEncapsulation.java b/core/src/main/java/org/bouncycastle/crypto/kems/ECIESKeyEncapsulation.java index f4dfc6ed..b5a145ac 100755 --- a/core/src/main/java/org/bouncycastle/crypto/kems/ECIESKeyEncapsulation.java +++ b/core/src/main/java/org/bouncycastle/crypto/kems/ECIESKeyEncapsulation.java @@ -128,11 +128,11 @@ public class ECIESKeyEncapsulation rPrime = r; } - ECPoint hTilde = ((ECPublicKeyParameters)key).getQ().multiply(rPrime); + ECPoint hTilde = ((ECPublicKeyParameters)key).getQ().multiply(rPrime).normalize(); // Encode the shared secret value int PEHlen = (key.getParameters().getCurve().getFieldSize() + 7) / 8; - byte[] PEH = BigIntegers.asUnsignedByteArray(PEHlen, hTilde.getX().toBigInteger()); + byte[] PEH = BigIntegers.asUnsignedByteArray(PEHlen, hTilde.getAffineXCoord().toBigInteger()); // Initialise the KDF byte[] kdfInput; @@ -215,11 +215,11 @@ public class ECIESKeyEncapsulation xHat = ((ECPrivateKeyParameters)key).getD(); } - ECPoint hTilde = gHat.multiply(xHat); + ECPoint hTilde = gHat.multiply(xHat).normalize(); // Encode the shared secret value int PEHlen = (key.getParameters().getCurve().getFieldSize() + 7) / 8; - byte[] PEH = BigIntegers.asUnsignedByteArray(PEHlen, hTilde.getX().toBigInteger()); + byte[] PEH = BigIntegers.asUnsignedByteArray(PEHlen, hTilde.getAffineXCoord().toBigInteger()); // Initialise the KDF byte[] kdfInput; |