private ECParameterSpec getParams(ECDSAPublicKey key) { if (!key.hasParameters()) { throw new IllegalArgumentException("Public key does not contains EC Params"); } BigInteger p = key.getPrimeModulusP(); ECCurve.Fp curve = new ECCurve.Fp(p, key.getFirstCoefA(), key.getSecondCoefB()); ECPoint G = curve.decodePoint(key.getBasePointG()); BigInteger order = key.getOrderOfBasePointR(); BigInteger coFactor = key.getCofactorF(); // TODO: update to use JDK 1.5 EC API ECParameterSpec ecspec = new ECParameterSpec(curve, G, order, coFactor); return ecspec; }
private ECParameterSpec getParams(ECDSAPublicKey key) { if (!key.hasParameters()) { throw new IllegalArgumentException("Public key does not contains EC Params"); } BigInteger p = key.getPrimeModulusP(); ECCurve.Fp curve = new ECCurve.Fp(p, key.getFirstCoefA(), key.getSecondCoefB(), key.getOrderOfBasePointR(), key.getCofactorF()); ECPoint G = curve.decodePoint(key.getBasePointG()); BigInteger order = key.getOrderOfBasePointR(); BigInteger coFactor = key.getCofactorF(); EllipticCurve jcaCurve = convertCurve(curve); return new ECParameterSpec(jcaCurve, new java.security.spec.ECPoint(G.getAffineXCoord().toBigInteger(), G.getAffineYCoord().toBigInteger()), order, coFactor.intValue()); }
private ECParameterSpec getParams(ECDSAPublicKey key) { if (!key.hasParameters()) { throw new IllegalArgumentException("Public key does not contains EC Params"); } BigInteger p = key.getPrimeModulusP(); ECCurve.Fp curve = new ECCurve.Fp(p, key.getFirstCoefA(), key.getSecondCoefB()); ECPoint G = curve.decodePoint(key.getBasePointG()); BigInteger order = key.getOrderOfBasePointR(); BigInteger coFactor = key.getCofactorF(); ECParameterSpec ecspec = new ECParameterSpec(curve, G, order, coFactor); return ecspec; }
private java.security.spec.ECPoint getPublicPoint(ECDSAPublicKey key) { if (!key.hasParameters()) { throw new IllegalArgumentException("Public key does not contains EC Params"); } BigInteger p = key.getPrimeModulusP(); ECCurve.Fp curve = new ECCurve.Fp(p, key.getFirstCoefA(), key.getSecondCoefB(), key.getOrderOfBasePointR(), key.getCofactorF()); ECPoint.Fp pubY = (ECPoint.Fp)curve.decodePoint(key.getPublicPointY()); return new java.security.spec.ECPoint(pubY.getAffineXCoord().toBigInteger(), pubY.getAffineYCoord().toBigInteger()); }