Java 8 ECPublicKeySpec - 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 ECPublicKeySpec class.

This code example shows how to use the following methods:getParams, getW
    public JCEECPublicKey( 
        String              algorithm,
        ECPublicKeySpec     spec)
    { 
        this.algorithm = algorithm;
        this.ecSpec = spec.getParams();
        this.q = EC5Util.convertPoint(ecSpec, spec.getW(), false);
    } 
 
    public JCEECPublicKey( 
        String              algorithm,
        org.bouncycastle.jce.spec.ECPublicKeySpec     spec)
    { 
        this.algorithm = algorithm;
        this.q = spec.getQ();
 
        if (spec.getParams() != null) // can be null if implictlyCa
        { 
            ECCurve curve = spec.getParams().getCurve();
            EllipticCurve ellipticCurve = EC5Util.convertCurve(curve, spec.getParams().getSeed());
7
CodeRank
This code example shows how to use the following methods:getParams, getW
    } 
 
    public BCECGOST3410PublicKey( 
        ECPublicKeySpec spec)
    { 
        this.ecSpec = spec.getParams();
        this.q = EC5Util.convertPoint(ecSpec, spec.getW(), false);
    } 
 
    public BCECGOST3410PublicKey( 
        org.bouncycastle.jce.spec.ECPublicKeySpec spec)
    { 
        this.q = spec.getQ();
 
        if (spec.getParams() != null) // can be null if implictlyCa
        { 
            ECCurve curve = spec.getParams().getCurve();
            EllipticCurve ellipticCurve = EC5Util.convertCurve(curve, spec.getParams().getSeed());
 
            this.ecSpec = EC5Util.convertSpec(ellipticCurve, spec.getParams());
6
CodeRank
This code example shows how to use the following methods:getParams, getW
    } 
 
    public BCDSTU4145PublicKey( 
        ECPublicKeySpec spec)
    { 
        this.ecSpec = spec.getParams();
        this.q = EC5Util.convertPoint(ecSpec, spec.getW(), false);
    } 
 
    public BCDSTU4145PublicKey( 
        org.bouncycastle.jce.spec.ECPublicKeySpec spec)
    { 
        this.q = spec.getQ();
 
        if (spec.getParams() != null) // can be null if implictlyCa
        { 
            ECCurve curve = spec.getParams().getCurve();
            EllipticCurve ellipticCurve = EC5Util.convertCurve(curve, spec.getParams().getSeed());
 
            this.ecSpec = EC5Util.convertSpec(ellipticCurve, spec.getParams());
6
CodeRank
This code example shows how to use the following methods:getParams, getW
        String algorithm,
        ECPublicKeySpec spec,
        ProviderConfiguration configuration)
    { 
        this.algorithm = algorithm;
        this.ecSpec = spec.getParams();
        this.q = EC5Util.convertPoint(ecSpec, spec.getW(), false);
        this.configuration = configuration;
    } 
 
    public BCECPublicKey( 
        String algorithm,
        org.bouncycastle.jce.spec.ECPublicKeySpec spec,
        ProviderConfiguration configuration)
    { 
        this.algorithm = algorithm;
        this.q = spec.getQ();
 
        if (spec.getParams() != null) // can be null if implictlyCa
        { 
6
CodeRank
This code example shows how to use the following methods:getParams, getW
    public JCEECPublicKey( 
        String              algorithm,
        ECPublicKeySpec     spec)
    { 
        this.algorithm = algorithm;
        this.ecSpec = spec.getParams();
        this.q = EC5Util.convertPoint(ecSpec, spec.getW(), false);
    } 
 
    public JCEECPublicKey( 
        String              algorithm,
        org.bouncycastle.jce.spec.ECPublicKeySpec     spec)
    { 
        this.algorithm = algorithm;
        this.q = spec.getQ();
 
        if (spec.getParams() != null) // can be null if implictlyCa
        { 
            ECCurve curve = spec.getParams().getCurve();
            EllipticCurve ellipticCurve = EC5Util.convertCurve(curve, spec.getParams().getSeed());
5
CodeRank
This code example shows how to use the following methods:getParams
                              BigInteger.valueOf(4L));
        ECPoint g = new ECPoint(BigInteger.ZERO, BigInteger.valueOf(2L));
        ECParameterSpec params =
            new ECParameterSpec(c, g, BigInteger.valueOf(5L), 10);
 
        ECPublicKeySpec ks = new ECPublicKeySpec(g, params);
        ECParameterSpec paramsRet = ks.getParams();
         
        assertEquals(params, paramsRet);
        assertSame(params, paramsRet);
    } 
 
    /** 
     * Test for <code>getW()</code> method<br> 
     * Assertion: returns associated public point<br> 
     * Test preconditions: <code>ECPublicKeySpec</code> instance 
     * created using valid parameters<br> 
     * Expected: must return w value which is equal 
     * to the one passed to the constructor; (both must refer 
     * the same object) 
5
CodeRank
This code example shows how to use the following methods:getParams, getW
     * case 3: catch NullPointerException - if params is null. 
     */ 
    public final void test_constructorLjava_security_spec_ECPointLjava_security_spec_ECParameterSpec() { 
 
        // case 1: creating object with valid parameters 
        assertEquals("wrong params value", params, ecpks.getParams());
        assertEquals("wrong w value", w, ecpks.getW());
 
        // case 2: catch NullPointerException - if w is null. 
        try { 
            new ECPublicKeySpec(null, params);
            fail("NullPointerException has not been thrown");
        } catch (NullPointerException e) {
            // expected 
        } 
 
        // case 3: catch NullPointerException - if params is null. 
        try { 
            new ECPublicKeySpec(w, null);
            fail("NullPointerException has not been thrown");
5
CodeRank
This code example shows how to use the following methods:
            final byte[] encoded = key.getEncoded();
            if (!"X.509".equals(key.getFormat()) || encoded == null) {
                throw new InvalidKeySpecException("Not a valid X.509 encoding");
            } 
            ECPublicKey ecKey = (ECPublicKey) engineGeneratePublic(new X509EncodedKeySpec(encoded));
            return (T) new ECPublicKeySpec(ecKey.getW(), ecKey.getParams());
        } else if (key instanceof ECPrivateKey
                && ECPrivateKeySpec.class.isAssignableFrom(keySpec)) {
            ECPrivateKey ecKey = (ECPrivateKey) key;
            return (T) new ECPrivateKeySpec(ecKey.getS(), ecKey.getParams());
        } else if (key instanceof PrivateKey && ECPrivateKeySpec.class.isAssignableFrom(keySpec)) {
            final byte[] encoded = key.getEncoded();
            if (!"PKCS#8".equals(key.getFormat()) || encoded == null) {
                throw new InvalidKeySpecException("Not a valid PKCS#8 encoding");
            } 
            ECPrivateKey ecKey =
                    (ECPrivateKey) engineGeneratePrivate(new PKCS8EncodedKeySpec(encoded));
            return (T) new ECPrivateKeySpec(ecKey.getS(), ecKey.getParams());
        } else if (key instanceof PrivateKey
                && PKCS8EncodedKeySpec.class.isAssignableFrom(keySpec)) {
5
CodeRank
This code example shows how to use the following methods:getParams, getW
        String algorithm,
        ECPublicKeySpec spec,
        ProviderConfiguration configuration)
    { 
        this.algorithm = algorithm;
        this.ecSpec = spec.getParams();
        this.q = EC5Util.convertPoint(ecSpec, spec.getW(), false);
        this.configuration = configuration;
    } 
 
    public BCECPublicKey( 
        String algorithm,
        org.bouncycastle.jce.spec.ECPublicKeySpec spec,
        ProviderConfiguration configuration)
    { 
        this.algorithm = algorithm;
        this.q = spec.getQ();
 
        if (spec.getParams() != null) // can be null if implictlyCa
        { 
5
CodeRank
This code example shows how to use the following methods:getParams, getW
    } 
 
    public BCECGOST3410PublicKey( 
        ECPublicKeySpec spec)
    { 
        this.ecSpec = spec.getParams();
        this.q = EC5Util.convertPoint(ecSpec, spec.getW(), false);
    } 
 
    public BCECGOST3410PublicKey( 
        org.bouncycastle.jce.spec.ECPublicKeySpec spec)
    { 
        this.q = spec.getQ();
 
        if (spec.getParams() != null) // can be null if implictlyCa
        { 
            ECCurve curve = spec.getParams().getCurve();
            EllipticCurve ellipticCurve = EC5Util.convertCurve(curve, spec.getParams().getSeed());
 
            this.ecSpec = EC5Util.convertSpec(ellipticCurve, spec.getParams());
5
CodeRank
See Code Examples for Java 8 ECPublicKeySpec Methods: