@Override
    public KeyPair generateKeyPair() {
        if (group == null) {
            final String curveName = SIZE_TO_CURVE_NAME.get(DEFAULT_KEY_SIZE);
            group = OpenSSLECGroupContext.getCurveByName(curveName);
            if (group == null) {
                throw new RuntimeException("Curve not recognized: " + curveName);
            }
        }

        final OpenSSLKey key = new OpenSSLKey(
                NativeCrypto.EC_KEY_generate_key(group.getNativeRef()));
        return new KeyPair(new OpenSSLECPublicKey(group, key), new OpenSSLECPrivateKey(group, key));
    }
An implementation of {@link KeyPairGenerator} for EC keys which uses BoringSSL to perform all the
operations.
common/src/main/java/org/conscrypt/OpenSSLECKeyPairGenerator.java