Java 8 ECParameterSpec - top ranked examples from Open Source projects

These code examples were ranked by Codota’s semantic indexing as the best open source examples for Java 8 ECParameterSpec class.

This code example shows how to use the following methods:getCofactor, getCurve, getGenerator, getOrder
        assertEquals(expected.getS(), actual.getS());
        assertECParametersEquals(expected.getParams(), actual.getParams());
    } 
 
    private static void assertECParametersEquals(ECParameterSpec expected, ECParameterSpec actual) {
        assertEquals(expected.getCurve(), actual.getCurve());
        assertEquals(expected.getGenerator(), actual.getGenerator());
        assertEquals(expected.getOrder(), actual.getOrder());
        assertEquals(expected.getCofactor(), actual.getCofactor());
    } 
 
    /** 
     * DH parameters pre-generated so that the test doesn't take too long. 
     * These parameters were generated with: 
     * 
     * openssl gendh 512 | openssl dhparams -C 
     */ 
    private static AlgorithmParameterSpec getDHParams() {
        BigInteger p = new BigInteger("E7AB1768BD75CD24700960FFA32D3F1557344E587101237532CC641646ED7A7C104743377F6D46251698B665CE2A6CBAB6714C2569A7D2CA22C0CF03FA40AC93", 16);
        BigInteger g = new BigInteger("02", 16);
7
CodeRank
Connect your IDE to all the code out there  Get Codota for Java
This code example shows how to use the following methods:getCofactor, getCurve, getGenerator, getOrder
        } 
    } 
 
    public BCDSTU4145PublicKey( 
        String algorithm,
        ECPublicKeyParameters params,
        org.bouncycastle.jce.spec.ECParameterSpec spec)
    { 
        ECDomainParameters dp = params.getParameters();
 
        this.algorithm = algorithm;
        this.q = params.getQ();
 
        if (spec == null)
        { 
            EllipticCurve ellipticCurve = EC5Util.convertCurve(dp.getCurve(), dp.getSeed());
 
            this.ecSpec = createSpec(ellipticCurve, dp);
        } 
        else 
7
CodeRank
Connect your IDE to all the code out there  Get Codota for Java
This code example shows how to use the following methods:getCofactor, getCurve, getGenerator, getOrder
     * case 6: IllegalArgumentException - if h is not positive 
     */ 
    public void test_constructorLjava_security_spec_EllipticCurveLjava_security_spec_ECPointLjava_math_BigIntegerI() { 
 
        // case 1: creating object with valid parameters 
        assertEquals("wrong cofactor was returned", 1, ecps.getCofactor());
        assertEquals("wrong elliptic curve", curve, ecps.getCurve());
        assertEquals("wrong generator was returned", ecpoint, ecps
                .getGenerator());
        assertEquals("wrong order was reteurned", BigInteger.valueOf(1), ecps
                .getOrder());
 
        // case 2: NullPointerException - if curve is null. 
        try { 
            new ECParameterSpec(null, ecpoint, BigInteger.valueOf(1), 1);
            fail("NullPointerException exception has not been thrown");
        } catch (NullPointerException e) {
            // expected 
        } 
 
6
CodeRank
Connect your IDE to all the code out there  Get Codota for Java
This code example shows how to use the following methods:getCofactor, getCurve, getGenerator, getOrder
        this.d = params.getD();
 
        if (spec == null)
        { 
            EllipticCurve ellipticCurve = EC5Util.convertCurve(dp.getCurve(), dp.getSeed());
 
            this.ecSpec = new ECParameterSpec(
                ellipticCurve,
                new ECPoint(
                    dp.getG().getAffineXCoord().toBigInteger(),
                    dp.getG().getAffineYCoord().toBigInteger()),
                dp.getN(),
                dp.getH().intValue());
        } 
        else 
        { 
            this.ecSpec = spec;
        } 
 
        publicKey = getPublicKeyDetails(pubKey);
7
CodeRank
Connect your IDE to all the code out there  Get Codota for Java
This code example shows how to use the following methods:
        this.ecSpec = null;
    } 
 
    private ECParameterSpec createSpec(EllipticCurve ellipticCurve, ECDomainParameters dp)
    { 
        return new ECParameterSpec(
                ellipticCurve,
                new ECPoint(
                        dp.getG().getX().toBigInteger(),
                        dp.getG().getY().toBigInteger()),
                        dp.getN(),
                        dp.getH().intValue());
    } 
     
    public JCEECPublicKey( 
        ECPublicKey     key)
    { 
        this.algorithm = key.getAlgorithm();
        this.ecSpec = key.getParams();
        this.q = EC5Util.convertPoint(this.ecSpec, key.getW(), false);
6
CodeRank
Connect your IDE to all the code out there  Get Codota for Java
This code example shows how to use the following methods:getCofactor, getCurve, getGenerator, getOrder
        assertEquals(expected.getS(), actual.getS());
        assertECParametersEquals(expected.getParams(), actual.getParams());
    } 
 
    private static void assertECParametersEquals(ECParameterSpec expected, ECParameterSpec actual) {
        assertEquals(expected.getCurve(), actual.getCurve());
        assertEquals(expected.getGenerator(), actual.getGenerator());
        assertEquals(expected.getOrder(), actual.getOrder());
        assertEquals(expected.getCofactor(), actual.getCofactor());
    } 
 
    /** 
     * DH parameters pre-generated so that the test doesn't take too long. 
     * These parameters were generated with: 
     * 
     * openssl gendh 512 | openssl dhparams -C 
     */ 
    private static AlgorithmParameterSpec getDHParams() {
        BigInteger p = new BigInteger("E7AB1768BD75CD24700960FFA32D3F1557344E587101237532CC641646ED7A7C104743377F6D46251698B665CE2A6CBAB6714C2569A7D2CA22C0CF03FA40AC93", 16);
        BigInteger g = new BigInteger("02", 16);
6
CodeRank
Connect your IDE to all the code out there  Get Codota for Java
This code example shows how to use the following methods:getCofactor, getCurve, getGenerator, getOrder
        ECPrivateKeyParameters params,
        BCECGOST3410PublicKey pubKey,
        ECParameterSpec spec)
    { 
        ECDomainParameters dp = params.getParameters();
 
        this.algorithm = algorithm;
        this.d = params.getD();
 
        if (spec == null)
        { 
            EllipticCurve ellipticCurve = EC5Util.convertCurve(dp.getCurve(), dp.getSeed());
 
            this.ecSpec = new ECParameterSpec(
                ellipticCurve,
                new ECPoint(
                    dp.getG().getAffineXCoord().toBigInteger(),
                    dp.getG().getAffineYCoord().toBigInteger()),
                dp.getN(),
                dp.getH().intValue());
7
CodeRank
Connect your IDE to all the code out there  Get Codota for Java
This code example shows how to use the following methods:getCofactor, getCurve, getGenerator, getOrder
            EllipticCurve ellipticCurve = EC5Util.convertCurve(dp.getCurve(), dp.getSeed());
 
            this.ecSpec = createSpec(ellipticCurve, dp);
        } 
        else 
        { 
            EllipticCurve ellipticCurve = EC5Util.convertCurve(spec.getCurve(), spec.getSeed());
 
            this.ecSpec = EC5Util.convertSpec(ellipticCurve, spec);
        } 
    } 
 
    /* 
     * called for implicitCA 
     */ 
    public BCECGOST3410PublicKey( 
        String algorithm,
        ECPublicKeyParameters params)
    { 
        this.algorithm = algorithm;
6
CodeRank
Connect your IDE to all the code out there  Get Codota for Java
This code example shows how to use the following methods:getCofactor, getCurve, getGenerator, getOrder
        this.q = params.getQ();
 
        if (spec == null)
        { 
            EllipticCurve ellipticCurve = EC5Util.convertCurve(dp.getCurve(), dp.getSeed());
 
            this.ecSpec = createSpec(ellipticCurve, dp);
        } 
        else 
        { 
            EllipticCurve ellipticCurve = EC5Util.convertCurve(spec.getCurve(), spec.getSeed());
 
            this.ecSpec = EC5Util.convertSpec(ellipticCurve, spec);
        } 
    } 
 
    /* 
     * called for implicitCA 
     */ 
    public BCDSTU4145PublicKey( 
6
CodeRank
Connect your IDE to all the code out there  Get Codota for Java
This code example shows how to use the following methods:getCofactor, getCurve, getGenerator, getOrder
            this.ecSpec = spec;
        } 
 
        this.configuration = configuration;
    } 
 
    public BCECPublicKey( 
        String algorithm,
        ECPublicKeyParameters params,
        org.bouncycastle.jce.spec.ECParameterSpec spec,
        ProviderConfiguration configuration)
    { 
        ECDomainParameters      dp = params.getParameters();
 
        this.algorithm = algorithm;
 
        if (spec == null)
        { 
            EllipticCurve ellipticCurve = EC5Util.convertCurve(dp.getCurve(), dp.getSeed());
 
6
CodeRank
Connect your IDE to all the code out there  Get Codota for Java
See Code Examples for Java 8 ECParameterSpec Methods: