static OpenSSLKey wrapJCAPrivateKeyForTLSStackOnly(PrivateKey privateKey,
            ECParameterSpec params) throws InvalidKeyException {
        if (params == null) {
            if (privateKey instanceof ECKey) {
                params = ((ECKey) privateKey).getParams();
            }
        }
        if (params == null) {
            throw new InvalidKeyException("EC parameters not available: " + privateKey);
        }

        OpenSSLECGroupContext group;
        try {
            group = OpenSSLECGroupContext.getInstance(params);
        } catch (InvalidAlgorithmParameterException e) {
            throw new InvalidKeyException("Invalid EC parameters: " + params);
        }

        return new OpenSSLKey(
                NativeCrypto.getECPrivateKeyWrapper(privateKey, group.getNativeRef()), true);
    }
Wraps the provided private key for use in the TLS/SSL stack only. Sign/decrypt operations
using the key will be delegated to the {@code Signature}/{@code Cipher} implementation of the
provider which accepts the key.
common/src/main/java/org/conscrypt/OpenSSLECPrivateKey.java