docs: public KeyPair toEC(boolean includePrivateParameters, Provider provider) {
  
          if (provider == null) {
              // Our default provider for this class
              provider = Security.getProvider("SunEC");
          }
  
          if (!JsonWebKeyType.EC.equals(kty) && !JsonWebKeyType.EC_HSM.equals(kty)) {
              throw new IllegalArgumentException("Not an EC key.");
          }
  
          try {
              KeyPairGenerator kpg = KeyPairGenerator.getInstance("EC", provider);
  
              ECGenParameterSpec gps = new ECGenParameterSpec(CURVE_TO_SPEC_NAME.get(crv));
              kpg.initialize(gps);
  
              // Generate dummy keypair to get parameter spec.
              KeyPair apair = kpg.generateKeyPair();
              ECPublicKey apub = (ECPublicKey) apair.getPublic();
              ECParameterSpec aspec = apub.getParams();
  
              ECPoint ecPoint = new ECPoint(new BigInteger(1, x), new BigInteger(1, y));
  
              KeyPair realKeyPair;
  
              if (includePrivateParameters) {
                  realKeyPair = new KeyPair(getECPublicKey(ecPoint, aspec, provider),
                          getECPrivateKey(d, aspec, provider));
              } else {
                  realKeyPair = new KeyPair(getECPublicKey(ecPoint, aspec, provider), null);
              }
  
              return realKeyPair;
          } catch (GeneralSecurityException e) {
              throw new IllegalStateException(e);
          }
      }