title: How do I get ECDH keypair in Android 9.0 pie?
body: <p>I want to get ECDH keypair (Public key and Private key). This method is not working in Android 9.0 pie, because Security provider "BC" , "SC" is removed from this version. I tried below method</p>
  
  <pre><code>KeyPairGenerator keyGen = KeyPairGenerator.getInstance("EC", "BC");
  SecureRandom random = SecureRandom.getInstance("SHA1PRNG");
  keyGen.initialize(256, random);
  KeyFactory kaif = KeyFactory.getInstance("EC", "BC");
  KeyPair pair = keyGen.generateKeyPair();
  PrivateKey privateKey = pair.getPrivate();
  PublicKey publicKey = pair.getPublic();
  </code></pre>
  
  <p>Following is the key which i got when using "BC" provider with the bove code, EC Private Key S: 30e3def89f6aca7ab4e1e0e0367bf936955339db03a0c32c63a08293066f9423 EC Public Key X: 1675a6b1c8097f651be6f6a555ab9e5da83f03d3082041ae29111609b98594be Y: ed23f9263c6a1e8892d03a0c33ed9d8bfc5886dfe67fb7947457e3ff43baffca</p>
  
  <p>Method 2: Security.insertProviderAt(BouncyCastleProvider(), 1);</p>
  
  <p>When i Add Bouncy castle in gradle and tried initiating like above, the output is follows privateKey = {OpenSSLECPrivateKey@7518} "OpenSSLECPrivateKey{params={ECDSA-Parameters: (256 bit)\n}}" publicKey = {OpenSSLECPublicKey@7519} "Public-Key: (256 bit)\n00000000 04 5c 2c 76 23 09 41 c4 16 e2 99 ea e0 fa ed 16 |.\,v#.A.........|\n00000010 52 ca 91 d2 0c fe 7f c4 94 76 54 9a 3c 49 ab a5 |R........vT.
  
  <p>I need this to be as simple as above in readable format, do i need to do any conversion to get keys in alphanumeric</p>