Search in sources :

Example 1 with ECPrivateKeySpec

use of java.security.spec.ECPrivateKeySpec in project robovm by robovm.

the class ECPrivateKeySpecTest method setUp.

protected void setUp() throws Exception {
    super.setUp();
    ECPoint ecpoint = new ECPoint(BigInteger.valueOf(1), BigInteger.valueOf(1));
    EllipticCurve curve = new EllipticCurve(new ECFieldF2m(2), BigInteger.valueOf(1), BigInteger.valueOf(1));
    s = BigInteger.valueOf(1);
    ecparams = new ECParameterSpec(curve, ecpoint, BigInteger.valueOf(1), 1);
    ecpks = new ECPrivateKeySpec(s, ecparams);
}
Also used : ECPrivateKeySpec(java.security.spec.ECPrivateKeySpec) EllipticCurve(java.security.spec.EllipticCurve) ECParameterSpec(java.security.spec.ECParameterSpec) ECFieldF2m(java.security.spec.ECFieldF2m) ECPoint(java.security.spec.ECPoint)

Example 2 with ECPrivateKeySpec

use of java.security.spec.ECPrivateKeySpec in project robovm by robovm.

the class OpenSSLECKeyFactory method engineTranslateKey.

@Override
protected Key engineTranslateKey(Key key) throws InvalidKeyException {
    if (key == null) {
        throw new InvalidKeyException("key == null");
    }
    if ((key instanceof OpenSSLECPublicKey) || (key instanceof OpenSSLECPrivateKey)) {
        return key;
    } else if (key instanceof ECPublicKey) {
        ECPublicKey ecKey = (ECPublicKey) key;
        ECPoint w = ecKey.getW();
        ECParameterSpec params = ecKey.getParams();
        try {
            return engineGeneratePublic(new ECPublicKeySpec(w, params));
        } catch (InvalidKeySpecException e) {
            throw new InvalidKeyException(e);
        }
    } else if (key instanceof ECPrivateKey) {
        ECPrivateKey ecKey = (ECPrivateKey) key;
        BigInteger s = ecKey.getS();
        ECParameterSpec params = ecKey.getParams();
        try {
            return engineGeneratePrivate(new ECPrivateKeySpec(s, params));
        } catch (InvalidKeySpecException e) {
            throw new InvalidKeyException(e);
        }
    } else if ((key instanceof PrivateKey) && ("PKCS#8".equals(key.getFormat()))) {
        byte[] encoded = key.getEncoded();
        if (encoded == null) {
            throw new InvalidKeyException("Key does not support encoding");
        }
        try {
            return engineGeneratePrivate(new PKCS8EncodedKeySpec(encoded));
        } catch (InvalidKeySpecException e) {
            throw new InvalidKeyException(e);
        }
    } else if ((key instanceof PublicKey) && ("X.509".equals(key.getFormat()))) {
        byte[] encoded = key.getEncoded();
        if (encoded == null) {
            throw new InvalidKeyException("Key does not support encoding");
        }
        try {
            return engineGeneratePublic(new X509EncodedKeySpec(encoded));
        } catch (InvalidKeySpecException e) {
            throw new InvalidKeyException(e);
        }
    } else {
        throw new InvalidKeyException("Key must be EC public or private key; was " + key.getClass().getName());
    }
}
Also used : ECPrivateKey(java.security.interfaces.ECPrivateKey) ECPrivateKeySpec(java.security.spec.ECPrivateKeySpec) PrivateKey(java.security.PrivateKey) ECPrivateKey(java.security.interfaces.ECPrivateKey) PublicKey(java.security.PublicKey) ECPublicKey(java.security.interfaces.ECPublicKey) X509EncodedKeySpec(java.security.spec.X509EncodedKeySpec) InvalidKeyException(java.security.InvalidKeyException) ECPoint(java.security.spec.ECPoint) ECPublicKeySpec(java.security.spec.ECPublicKeySpec) ECPublicKey(java.security.interfaces.ECPublicKey) ECParameterSpec(java.security.spec.ECParameterSpec) PKCS8EncodedKeySpec(java.security.spec.PKCS8EncodedKeySpec) BigInteger(java.math.BigInteger) InvalidKeySpecException(java.security.spec.InvalidKeySpecException)

Example 3 with ECPrivateKeySpec

use of java.security.spec.ECPrivateKeySpec in project leshan by eclipse.

the class LeshanServerDemo method createAndStartServer.

public static void createAndStartServer(int webPort, String localAddress, int localPort, String secureLocalAddress, int secureLocalPort, String modelsFolderPath, String redisUrl, String keyStorePath, String keyStoreType, String keyStorePass, String keyStoreAlias, String keyStoreAliasPass, Boolean publishDNSSdServices) throws Exception {
    // Prepare LWM2M server
    LeshanServerBuilder builder = new LeshanServerBuilder();
    builder.setLocalAddress(localAddress, localPort);
    builder.setLocalSecureAddress(secureLocalAddress, secureLocalPort);
    builder.setEncoder(new DefaultLwM2mNodeEncoder());
    LwM2mNodeDecoder decoder = new DefaultLwM2mNodeDecoder();
    builder.setDecoder(decoder);
    // Create CoAP Config
    NetworkConfig coapConfig;
    File configFile = new File(NetworkConfig.DEFAULT_FILE_NAME);
    if (configFile.isFile()) {
        coapConfig = new NetworkConfig();
        coapConfig.load(configFile);
    } else {
        coapConfig = LeshanServerBuilder.createDefaultNetworkConfig();
        coapConfig.store(configFile);
    }
    builder.setCoapConfig(coapConfig);
    // connect to redis if needed
    Pool<Jedis> jedis = null;
    if (redisUrl != null) {
        // TODO: support sentinel pool and make pool configurable
        jedis = new JedisPool(new URI(redisUrl));
    }
    PublicKey publicKey = null;
    // Set up X.509 mode
    if (keyStorePath != null) {
        try {
            KeyStore keyStore = KeyStore.getInstance(keyStoreType);
            try (FileInputStream fis = new FileInputStream(keyStorePath)) {
                keyStore.load(fis, keyStorePass == null ? null : keyStorePass.toCharArray());
                List<Certificate> trustedCertificates = new ArrayList<>();
                for (Enumeration<String> aliases = keyStore.aliases(); aliases.hasMoreElements(); ) {
                    String alias = aliases.nextElement();
                    if (keyStore.isCertificateEntry(alias)) {
                        trustedCertificates.add(keyStore.getCertificate(alias));
                    } else if (keyStore.isKeyEntry(alias) && alias.equals(keyStoreAlias)) {
                        List<X509Certificate> x509CertificateChain = new ArrayList<>();
                        Certificate[] certificateChain = keyStore.getCertificateChain(alias);
                        if (certificateChain == null || certificateChain.length == 0) {
                            LOG.error("Keystore alias must have a non-empty chain of X509Certificates.");
                            System.exit(-1);
                        }
                        for (Certificate certificate : certificateChain) {
                            if (!(certificate instanceof X509Certificate)) {
                                LOG.error("Non-X.509 certificate in alias chain is not supported: {}", certificate);
                                System.exit(-1);
                            }
                            x509CertificateChain.add((X509Certificate) certificate);
                        }
                        Key key = keyStore.getKey(alias, keyStoreAliasPass == null ? new char[0] : keyStoreAliasPass.toCharArray());
                        if (!(key instanceof PrivateKey)) {
                            LOG.error("Keystore alias must have a PrivateKey entry, was {}", key == null ? null : key.getClass().getName());
                            System.exit(-1);
                        }
                        builder.setPrivateKey((PrivateKey) key);
                        publicKey = keyStore.getCertificate(alias).getPublicKey();
                        builder.setCertificateChain(x509CertificateChain.toArray(new X509Certificate[x509CertificateChain.size()]));
                    }
                }
                builder.setTrustedCertificates(trustedCertificates.toArray(new Certificate[trustedCertificates.size()]));
            }
        } catch (KeyStoreException | IOException e) {
            LOG.error("Unable to initialize X.509.", e);
            System.exit(-1);
        }
    } else // Otherwise, set up RPK mode
    {
        try {
            // Get point values
            byte[] publicX = Hex.decodeHex("fcc28728c123b155be410fc1c0651da374fc6ebe7f96606e90d927d188894a73".toCharArray());
            byte[] publicY = Hex.decodeHex("d2ffaa73957d76984633fc1cc54d0b763ca0559a9dff9706e9f4557dacc3f52a".toCharArray());
            byte[] privateS = Hex.decodeHex("1dae121ba406802ef07c193c1ee4df91115aabd79c1ed7f4c0ef7ef6a5449400".toCharArray());
            // Get Elliptic Curve Parameter spec for secp256r1
            AlgorithmParameters algoParameters = AlgorithmParameters.getInstance("EC");
            algoParameters.init(new ECGenParameterSpec("secp256r1"));
            ECParameterSpec parameterSpec = algoParameters.getParameterSpec(ECParameterSpec.class);
            // Create key specs
            KeySpec publicKeySpec = new ECPublicKeySpec(new ECPoint(new BigInteger(publicX), new BigInteger(publicY)), parameterSpec);
            KeySpec privateKeySpec = new ECPrivateKeySpec(new BigInteger(privateS), parameterSpec);
            // Get keys
            publicKey = KeyFactory.getInstance("EC").generatePublic(publicKeySpec);
            PrivateKey privateKey = KeyFactory.getInstance("EC").generatePrivate(privateKeySpec);
            builder.setPublicKey(publicKey);
            builder.setPrivateKey(privateKey);
        } catch (InvalidKeySpecException | NoSuchAlgorithmException | InvalidParameterSpecException e) {
            LOG.error("Unable to initialize RPK.", e);
            System.exit(-1);
        }
    }
    // Define model provider
    List<ObjectModel> models = ObjectLoader.loadDefault();
    models.addAll(ObjectLoader.loadDdfResources("/models/", modelPaths));
    if (modelsFolderPath != null) {
        models.addAll(ObjectLoader.loadObjectsFromDir(new File(modelsFolderPath)));
    }
    LwM2mModelProvider modelProvider = new StaticModelProvider(models);
    builder.setObjectModelProvider(modelProvider);
    // Set securityStore & registrationStore
    EditableSecurityStore securityStore;
    if (jedis == null) {
        // use file persistence
        securityStore = new FileSecurityStore();
    } else {
        // use Redis Store
        securityStore = new RedisSecurityStore(jedis);
        builder.setRegistrationStore(new RedisRegistrationStore(jedis));
    }
    builder.setSecurityStore(securityStore);
    // Create and start LWM2M server
    LeshanServer lwServer = builder.build();
    // Now prepare Jetty
    Server server = new Server(webPort);
    WebAppContext root = new WebAppContext();
    root.setContextPath("/");
    root.setResourceBase(LeshanServerDemo.class.getClassLoader().getResource("webapp").toExternalForm());
    root.setParentLoaderPriority(true);
    server.setHandler(root);
    // Create Servlet
    EventServlet eventServlet = new EventServlet(lwServer, lwServer.getSecuredAddress().getPort());
    ServletHolder eventServletHolder = new ServletHolder(eventServlet);
    root.addServlet(eventServletHolder, "/event/*");
    ServletHolder clientServletHolder = new ServletHolder(new ClientServlet(lwServer, lwServer.getSecuredAddress().getPort()));
    root.addServlet(clientServletHolder, "/api/clients/*");
    ServletHolder securityServletHolder = new ServletHolder(new SecurityServlet(securityStore, publicKey));
    root.addServlet(securityServletHolder, "/api/security/*");
    ServletHolder objectSpecServletHolder = new ServletHolder(new ObjectSpecServlet(lwServer.getModelProvider()));
    root.addServlet(objectSpecServletHolder, "/api/objectspecs/*");
    // Register a service to DNS-SD
    if (publishDNSSdServices) {
        // Create a JmDNS instance
        JmDNS jmdns = JmDNS.create(InetAddress.getLocalHost());
        // Publish Leshan HTTP Service
        ServiceInfo httpServiceInfo = ServiceInfo.create("_http._tcp.local.", "leshan", webPort, "");
        jmdns.registerService(httpServiceInfo);
        // Publish Leshan CoAP Service
        ServiceInfo coapServiceInfo = ServiceInfo.create("_coap._udp.local.", "leshan", localPort, "");
        jmdns.registerService(coapServiceInfo);
        // Publish Leshan Secure CoAP Service
        ServiceInfo coapSecureServiceInfo = ServiceInfo.create("_coaps._udp.local.", "leshan", secureLocalPort, "");
        jmdns.registerService(coapSecureServiceInfo);
    }
    // Start Jetty & Leshan
    lwServer.start();
    server.start();
    LOG.info("Web server started at {}.", server.getURI());
}
Also used : PrivateKey(java.security.PrivateKey) ECPrivateKeySpec(java.security.spec.ECPrivateKeySpec) JmDNS(javax.jmdns.JmDNS) Server(org.eclipse.jetty.server.Server) LeshanServer(org.eclipse.leshan.server.californium.impl.LeshanServer) ECPublicKeySpec(java.security.spec.ECPublicKeySpec) KeySpec(java.security.spec.KeySpec) ECPrivateKeySpec(java.security.spec.ECPrivateKeySpec) ArrayList(java.util.ArrayList) NoSuchAlgorithmException(java.security.NoSuchAlgorithmException) ECPublicKeySpec(java.security.spec.ECPublicKeySpec) FileSecurityStore(org.eclipse.leshan.server.impl.FileSecurityStore) ServiceInfo(javax.jmdns.ServiceInfo) Jedis(redis.clients.jedis.Jedis) WebAppContext(org.eclipse.jetty.webapp.WebAppContext) LeshanServerBuilder(org.eclipse.leshan.server.californium.LeshanServerBuilder) LeshanServer(org.eclipse.leshan.server.californium.impl.LeshanServer) List(java.util.List) ArrayList(java.util.ArrayList) InvalidKeySpecException(java.security.spec.InvalidKeySpecException) SecurityServlet(org.eclipse.leshan.server.demo.servlet.SecurityServlet) PublicKey(java.security.PublicKey) FileInputStream(java.io.FileInputStream) X509Certificate(java.security.cert.X509Certificate) RedisSecurityStore(org.eclipse.leshan.server.cluster.RedisSecurityStore) ObjectSpecServlet(org.eclipse.leshan.server.demo.servlet.ObjectSpecServlet) ClientServlet(org.eclipse.leshan.server.demo.servlet.ClientServlet) ECParameterSpec(java.security.spec.ECParameterSpec) LwM2mModelProvider(org.eclipse.leshan.server.model.LwM2mModelProvider) RedisRegistrationStore(org.eclipse.leshan.server.cluster.RedisRegistrationStore) BigInteger(java.math.BigInteger) JedisPool(redis.clients.jedis.JedisPool) File(java.io.File) Key(java.security.Key) PrivateKey(java.security.PrivateKey) PublicKey(java.security.PublicKey) X509Certificate(java.security.cert.X509Certificate) Certificate(java.security.cert.Certificate) AlgorithmParameters(java.security.AlgorithmParameters) ObjectModel(org.eclipse.leshan.core.model.ObjectModel) ServletHolder(org.eclipse.jetty.servlet.ServletHolder) ECGenParameterSpec(java.security.spec.ECGenParameterSpec) DefaultLwM2mNodeEncoder(org.eclipse.leshan.core.node.codec.DefaultLwM2mNodeEncoder) URI(java.net.URI) DefaultLwM2mNodeDecoder(org.eclipse.leshan.core.node.codec.DefaultLwM2mNodeDecoder) LwM2mNodeDecoder(org.eclipse.leshan.core.node.codec.LwM2mNodeDecoder) DefaultLwM2mNodeDecoder(org.eclipse.leshan.core.node.codec.DefaultLwM2mNodeDecoder) EventServlet(org.eclipse.leshan.server.demo.servlet.EventServlet) InvalidParameterSpecException(java.security.spec.InvalidParameterSpecException) StaticModelProvider(org.eclipse.leshan.server.model.StaticModelProvider) NetworkConfig(org.eclipse.californium.core.network.config.NetworkConfig) KeyStoreException(java.security.KeyStoreException) IOException(java.io.IOException) ECPoint(java.security.spec.ECPoint) EditableSecurityStore(org.eclipse.leshan.server.security.EditableSecurityStore) KeyStore(java.security.KeyStore)

Example 4 with ECPrivateKeySpec

use of java.security.spec.ECPrivateKeySpec in project tink by google.

the class EllipticCurves method getEcPrivateKey.

/**
 * Returns an {@code ECPrivateKey} from {@code curve} type and {@code keyValue}.
 */
public static ECPrivateKey getEcPrivateKey(CurveType curve, final byte[] keyValue) throws GeneralSecurityException {
    ECParameterSpec ecParams = getCurveSpec(curve);
    BigInteger privValue = new BigInteger(1, keyValue);
    ECPrivateKeySpec spec = new ECPrivateKeySpec(privValue, ecParams);
    KeyFactory kf = EngineFactory.KEY_FACTORY.getInstance("EC");
    return (ECPrivateKey) kf.generatePrivate(spec);
}
Also used : ECPrivateKey(java.security.interfaces.ECPrivateKey) ECPrivateKeySpec(java.security.spec.ECPrivateKeySpec) ECParameterSpec(java.security.spec.ECParameterSpec) BigInteger(java.math.BigInteger) KeyFactory(java.security.KeyFactory)

Example 5 with ECPrivateKeySpec

use of java.security.spec.ECPrivateKeySpec in project wycheproof by google.

the class EcdhTest method testTiming.

/**
 * This test tries to determine whether point multipliplication using two distinct
 * points leads to distinguishable timings.
 *
 * The main goal here is to determine if the attack by Toru Akishita and Tsuyoshi Takagi
 * in https://www-old.cdc.informatik.tu-darmstadt.de/reports/TR/TI-03-01.zvp.pdf
 * might be applicable. I.e. one of the points contains a zero value when multiplied
 * by mul, the other one does not.
 *
 * In its current form the test here is quite weak for a number of reasons:
 * (1) The timing is often noisy, because the test is run as a unit test.
 * (2) The test is executed with only a small number of input points.
 * (3) The number of samples is rather low. Running this test with a larger sample
 *     size would detect more timing differences. Unfortunately
 * (4) The test does not determine if a variable run time is exploitable. For example
 *     if the tested provider uses windowed exponentiation and the special point is
 *     in the precomputation table then timing differences are easy to spot, but more
 *     difficult to exploit and hence additional experiments would be necessary.
 *
 * @param spec the specification of the curve
 * @param p0 This is a special point. I.e. multiplying this point by mul
 *           may lead to a zero value that may be observable.
 * @param p1 a random point on the curve
 * @param mul an integer, such that multiplying p0 with this value may lead to a timing
 *        difference
 * @param privKeySize the size of the private key in bits
 * @param comment describes the test case
 */
private void testTiming(ECParameterSpec spec, ECPoint p0, ECPoint p1, BigInteger mul, int privKeySize, String comment) throws Exception {
    ThreadMXBean bean = ManagementFactory.getThreadMXBean();
    if (!bean.isCurrentThreadCpuTimeSupported()) {
        System.out.println("getCurrentThreadCpuTime is not supported. Skipping");
        return;
    }
    SecureRandom random = new SecureRandom();
    int fixedSize = mul.bitLength();
    int missingBits = privKeySize - 2 * fixedSize;
    assertTrue(missingBits > 0);
    // possible values for tests, minCount:
    // 1024,  410
    // 2048,  880
    // 4096, 1845
    // 10000, 4682
    // I.e. these are values, such that doing 'tests' coin flips results in <= minCount heads or
    // tails with a probability smaller than 2^-32.
    // 
    // def min_count(n, b=33):
    // res, sum, k = 1,1,0
    // bnd = 2**(n-b)
    // while sum < bnd:
    // res *= n - k
    // res //= 1 + k
    // k += 1
    // sum += res
    // return k - 1
    final int tests = 2048;
    final int minCount = 880;
    // the number of measurements done with each point
    final int repetitions = 8;
    // the number of warmup experiments that are ignored
    final int warmup = 8;
    final int sampleSize = warmup + tests;
    KeyFactory kf = KeyFactory.getInstance("EC");
    PublicKey[] publicKeys = new PublicKey[2];
    try {
        publicKeys[0] = kf.generatePublic(new ECPublicKeySpec(p0, spec));
        publicKeys[1] = kf.generatePublic(new ECPublicKeySpec(p1, spec));
    } catch (InvalidKeySpecException ex) {
        // unsupported curve
        return;
    }
    PrivateKey[] privKeys = new PrivateKey[sampleSize];
    for (int i = 0; i < sampleSize; i++) {
        BigInteger m = new BigInteger(missingBits, random);
        m = mul.shiftLeft(missingBits).add(m);
        m = m.shiftLeft(fixedSize).add(mul);
        ECPrivateKeySpec privSpec = new ECPrivateKeySpec(m, spec);
        privKeys[i] = kf.generatePrivate(privSpec);
    }
    KeyAgreement ka = KeyAgreement.getInstance("ECDH");
    long[][] timings = new long[2][sampleSize];
    for (int i = 0; i < sampleSize; i++) {
        for (int j = 0; j < 2 * repetitions; j++) {
            // idx determines which key to use.
            int idx = (j ^ i) & 1;
            ka.init(privKeys[i]);
            long start = bean.getCurrentThreadCpuTime();
            ka.doPhase(publicKeys[idx], true);
            byte[] unused = ka.generateSecret();
            long time = bean.getCurrentThreadCpuTime() - start;
            timings[idx][i] += time;
        }
    }
    for (int i = 0; i < sampleSize; i++) {
        for (int j = 0; j < 2; j++) {
            timings[j][i] /= repetitions;
        }
    }
    // Performs some statistics.
    // Set to true, if the timings have a large variance.
    boolean noisy = false;
    System.out.println("ECDH timing test:" + comment);
    double[] avg = new double[2];
    double[] var = new double[2];
    for (int i = 0; i < 2; i++) {
        double sum = 0.0;
        double sumSqr = 0.0;
        for (int j = warmup; j < sampleSize; j++) {
            double val = (double) timings[i][j];
            sum += val;
            sumSqr += val * val;
        }
        avg[i] = sum / tests;
        var[i] = (sumSqr - avg[i] * sum) / (tests - 1);
        double stdDev = Math.sqrt(var[i]);
        double cv = stdDev / avg[i];
        System.out.println("Timing for point " + i + " avg: " + avg[i] + " std dev: " + stdDev + " cv:" + cv);
        // is too big to detect even larger timing differences.
        if (cv > 0.05) {
            noisy = true;
        }
    }
    // Paired Z-test:
    // The outcome of this value can be significantly influenced by extreme outliers, such
    // as slow timings because of things like a garbage collection.
    double sigmas = Math.abs(avg[0] - avg[1]) / Math.sqrt((var[0] + var[1]) / tests);
    System.out.println("Sigmas: " + sigmas);
    // Pairwise comparison:
    // this comparison has the property that it compares timings done with the same
    // private key, hence timing differences from using different addition chain sizes
    // are ignored. Extreme outliers should not influence the result a lot, as long as the
    // number of outliers is small.
    int point0Faster = 0;
    int equal = 0;
    for (int i = 0; i < sampleSize; i++) {
        if (timings[0][i] < timings[1][i]) {
            point0Faster += 1;
        } else if (timings[0][i] < timings[1][i]) {
            equal += 1;
        }
    }
    point0Faster += equal / 2;
    System.out.println("Point 0 multiplication is faster: " + point0Faster);
    if (point0Faster < minCount || point0Faster > sampleSize - minCount) {
        fail("Timing differences in ECDH computation detected");
    } else if (noisy) {
        System.out.println("Timing was too noisy to expect results.");
    }
}
Also used : ThreadMXBean(java.lang.management.ThreadMXBean) ECPrivateKey(java.security.interfaces.ECPrivateKey) PrivateKey(java.security.PrivateKey) ECPrivateKeySpec(java.security.spec.ECPrivateKeySpec) PublicKey(java.security.PublicKey) ECPublicKey(java.security.interfaces.ECPublicKey) SecureRandom(java.security.SecureRandom) ECPoint(java.security.spec.ECPoint) ECPublicKeySpec(java.security.spec.ECPublicKeySpec) BigInteger(java.math.BigInteger) InvalidKeySpecException(java.security.spec.InvalidKeySpecException) KeyAgreement(javax.crypto.KeyAgreement) KeyFactory(java.security.KeyFactory)

Aggregations

ECPrivateKeySpec (java.security.spec.ECPrivateKeySpec)14 BigInteger (java.math.BigInteger)9 KeyFactory (java.security.KeyFactory)6 ECParameterSpec (java.security.spec.ECParameterSpec)6 ECPoint (java.security.spec.ECPoint)6 ECPrivateKey (java.security.interfaces.ECPrivateKey)5 PrivateKey (java.security.PrivateKey)4 PublicKey (java.security.PublicKey)4 InvalidKeySpecException (java.security.spec.InvalidKeySpecException)4 ECPublicKey (java.security.interfaces.ECPublicKey)3 ECPublicKeySpec (java.security.spec.ECPublicKeySpec)3 KeyAgreement (javax.crypto.KeyAgreement)3 GeneralSecurityException (java.security.GeneralSecurityException)2 InvalidKeyException (java.security.InvalidKeyException)2 NoSuchAlgorithmException (java.security.NoSuchAlgorithmException)2 ECFieldF2m (java.security.spec.ECFieldF2m)2 EllipticCurve (java.security.spec.EllipticCurve)2 X509EncodedKeySpec (java.security.spec.X509EncodedKeySpec)2 JsonElement (com.google.gson.JsonElement)1 JsonObject (com.google.gson.JsonObject)1