title: Bouncycastle encryption algorithms not provided
body: <p>I'm trying to use BouncyCastle with android to implement ECDH and EL Gamal. I've added the bouncycastle jar file (bcprov-jdk16-144.jar) and written some code that works with my computers jvm however when I try and port it to my android application it throws: </p>
  
  <pre><code>java.security.NoSuchAlgorithmException: KeyPairGenerator ECDH implementation not found
  </code></pre>
  
  <p>A sample of the code is:</p>
  
  <pre><code>Security.addProvider(new org.bouncycastle.jce.provider.BouncyCastleProvider());
  
  java.security.KeyPairGenerator keyGen = org.bouncycastle.jce.provider.asymmetric.ec.KeyPairGenerator.getInstance("ECDH", "BC");
                  ECGenParameterSpec ecSpec = new ECGenParameterSpec("prime192v1");
  
                  keyGen.initialize(ecSpec, SecureRandom.getInstance("SHA1PRNG"));
  
  
  
                  KeyPair pair = keyGen.generateKeyPair();
                  PublicKey pubk = pair.getPublic();
                  PrivateKey prik = pair.getPrivate();
  </code></pre>
  
  <p>I then wrote a simple program to see what encryption algorithms are available and ran it on my android emulator and on my computers jvm the code was:</p>
  
  <pre><code>Set&lt;Provider.Service&gt; rar = new org.bouncycastle.jce.provider.BouncyCastleProvider().getServices();
      Iterator&lt;Provider.Service&gt; ir = rar.iterator();
      while(ir.hasNext())
          System.out.println(ir.next().getAlgorithm());
  </code></pre>
  
  <p>On android I do not get any of the EC algorithms while ran normally on my computer it's fine.</p>
  
  <p>I'm also getting the following two errors when compiling for a lot of the bouncy castle classes:</p>
  
  <p>01-07 17:17:42.548: INFO/dalvikvm(1054): DexOpt: not resolving ambiguous class 'Lorg/bouncycastle/asn1/ASN1Encodable;'</p>
  
  <p>01-07 17:17:42.548: DEBUG/dalvikvm(1054): DexOpt: not verifying 'Lorg/bouncycastle/asn1/ess/OtherSigningCertificate;': multiple definitions </p>
  
  <p>What am I doing wrong?</p>