title: ECGenParameterSpec unknown curve name 'secp256k1'
body: <p>I have project which creates private and public keys. I want to encrypt them with ecdsa, because of this I use ECGenParameterSpec with 'secp256k1' parameter but this gives error. If I change it with 'secp256r1' there is no problem. Here is my code to generate keys:</p>
  
  <pre><code>        KeyPairGenerator keyGen = KeyPairGenerator.getInstance("EC");
  
          ECGenParameterSpec ecSpec = newECGenParameterSpec("secp256k1");
          keyGen.initialize(ecSpec);
  
          KeyPair kp = keyGen.generateKeyPair();
          PublicKey pub = kp.getPublic();
          PrivateKey pvt = kp.getPrivate();
  
          ECPrivateKey epvt = (ECPrivateKey)pvt;
          String sepvt = adjustTo64(epvt.getS().toString(16));
          System.out.println("s[" + sepvt.length() + "]: " + sepvt);
  
          ECPublicKey epub = (ECPublicKey)pub;
          ECPoint pt = epub.getW();
          String sx = adjustTo64(pt.getAffineX().toString(16));
          String sy = adjustTo64(pt.getAffineY().toString(16));
          String bcPub = sx + sy;
          System.out.println("bcPub: " + bcPub);
  
          return bcPub;
  </code></pre>
  
  <p>To adjust 64 bit </p>
  
  <pre><code>        static private String adjustTo64(String s) {
            switch(s.length()) {
            case 62: return "00" + s;
            case 63: return "0" + s;
            case 64: return s;
            default:
              throw new IllegalArgumentException("not a valid key: " +s);
            }
          }
  </code></pre>
  
  <p>When I use secp256k1 it gives this error:</p>
  
  <pre><code>05-01 12:20:46.066 17297-17297/com.sikke.app W/System.err: java.security.InvalidAlgorithmParameterException: unknown curve name: secp256k1
      at com.android.org.conscrypt.OpenSSLECKeyPairGenerator.initialize(OpenSSLECKeyPairGenerator.java:113)
      at java.security.KeyPairGenerator.initialize(KeyPairGenerator.java:439)
      at com.sikke.app.AppHelper.getEcdsa(AppHelper.java:125)
      at com.sikke.app.activities.AccountActivity.onCreate(AccountActivity.java:59)
      at android.app.Activity.performCreate(Activity.java:6975)
      at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1213)
      at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2770)
      at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2892)
      at android.app.ActivityThread.-wrap11(Unknown Source:0)
      at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1593)
      at android.os.Handler.dispatchMessage(Handler.java:105)
      at android.os.Looper.loop(Looper.java:164)
      at android.app.ActivityThread.main(ActivityThread.java:6541)05-01 12:20:46.067 17297-17297/com.sikke.app W/System.err:     at java.lang.reflect.Method.invoke(Native Method)
      at com.android.internal.os.Zygote$MethodAndArgsCaller.run(Zygote.java:240)
      at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:767)
  </code></pre>