/** * Multiplies this <code>ECPoint</code> by the given number. * @param k The multiplicator. * @return <code>k * this</code>. */ public ECPoint multiply(BigInteger k) { return this.getCurve().getMultiplier().multiply(this, k); }
/** * Multiplies this <code>ECPoint</code> by the given number. * @param k The multiplicator. * @return <code>k * this</code>. */ public ECPoint multiply(BigInteger k) { return this.getCurve().getMultiplier().multiply(this, k); }
private BigInteger getScalarMultipleXCoord(ECPoint p, BigInteger s) { return _fixedPointMultiplier.multiply(p, s).normalize().getAffineXCoord().toBigInteger(); } }
private BigInteger getScalarMultipleXCoord(ECPoint p, BigInteger s) { return _fixedPointMultiplier.multiply(p, s).normalize().getAffineXCoord().toBigInteger(); } }
ECPoint p = basePointMultiplier.multiply(ec.getG(), k).normalize();
ECPoint p = basePointMultiplier.multiply(ec.getG(), k).normalize();
ECPoint p = basePointMultiplier.multiply(ec.getG(), k).normalize();
ECPoint p = basePointMultiplier.multiply(ecParams.getG(), k).normalize();
ECPoint p = basePointMultiplier.multiply(ecParams.getG(), k).normalize();
ECPoint Q = createBasePointMultiplier().multiply(params.getG(), d);
ECPoint p = basePointMultiplier.multiply(ec.getG(), k).normalize();
ECPoint p = basePointMultiplier.multiply(ec.getG(), k).normalize();
/** * Given the domain parameters this routine generates an EC key * pair in accordance with X9.62 section 5.2.1 pages 26, 27. */ public AsymmetricCipherKeyPair generateKeyPair() { BigInteger n = params.getN(); int nBitLength = n.bitLength(); int minWeight = nBitLength >>> 2; BigInteger d; for (;;) { d = BigIntegers.createRandomBigInteger(nBitLength, random); if (d.compareTo(TWO) < 0 || (d.compareTo(n) >= 0)) { continue; } if (WNafUtil.getNafWeight(d) < minWeight) { continue; } break; } ECPoint Q = createBasePointMultiplier().multiply(params.getG(), d); return new AsymmetricCipherKeyPair( new ECPublicKeyParameters(Q, params), new ECPrivateKeyParameters(d, params)); }
Fe = basePointMultiplier.multiply(ec.getG(), e).normalize().getAffineXCoord();
Fe = basePointMultiplier.multiply(ec.getG(), e).normalize().getAffineXCoord();
basePointMultiplier.multiply(ecParams.getG(), r), ecPubKey.getQ().multiply(rPrime) };
basePointMultiplier.multiply(ecParams.getG(), r), ecPubKey.getQ().multiply(rPrime) };
/** * Process a single EC point using the basic ElGamal algorithm. * * @param point the EC point to process. * @return the result of the Elgamal process. */ public ECPair encrypt(ECPoint point) { if (key == null) { throw new IllegalStateException("ECElGamalEncryptor not initialised"); } ECDomainParameters ec = key.getParameters(); BigInteger k = ECUtil.generateK(ec.getN(), random); ECMultiplier basePointMultiplier = createBasePointMultiplier(); ECPoint[] gamma_phi = new ECPoint[]{ basePointMultiplier.multiply(ec.getG(), k), key.getQ().multiply(k).add(point) }; ec.getCurve().normalizeAll(gamma_phi); return new ECPair(gamma_phi[0], gamma_phi[1]); }
/** * Transform an existing cipher text pair using the ElGamal algorithm. Note: it is assumed this * transform has been initialised with the same public key that was used to create the original * cipher text. * * @param cipherText the EC point to process. * @return returns a new ECPair representing the result of the process. */ public ECPair transform(ECPair cipherText) { if (key == null) { throw new IllegalStateException("ECFixedTransform not initialised"); } ECDomainParameters ec = key.getParameters(); BigInteger n = ec.getN(); ECMultiplier basePointMultiplier = createBasePointMultiplier(); BigInteger k = this.k.mod(n); ECPoint[] gamma_phi = new ECPoint[]{ basePointMultiplier.multiply(ec.getG(), k).add(cipherText.getX()), key.getQ().multiply(k).add(cipherText.getY()) }; ec.getCurve().normalizeAll(gamma_phi); return new ECPair(gamma_phi[0], gamma_phi[1]); }
/** * Transform an existing cipher text pair using the ElGamal algorithm. Note: the input cipherText will * need to be preserved in order to complete the transformation to the new public key. * * @param cipherText the EC point to process. * @return returns a new ECPair representing the result of the process. */ public ECPair transform(ECPair cipherText) { if (key == null) { throw new IllegalStateException("ECNewPublicKeyTransform not initialised"); } ECDomainParameters ec = key.getParameters(); BigInteger n = ec.getN(); ECMultiplier basePointMultiplier = createBasePointMultiplier(); BigInteger k = ECUtil.generateK(n, random); ECPoint[] gamma_phi = new ECPoint[]{ basePointMultiplier.multiply(ec.getG(), k), key.getQ().multiply(k).add(cipherText.getY()) }; ec.getCurve().normalizeAll(gamma_phi); return new ECPair(gamma_phi[0], gamma_phi[1]); }