title: ECIES encryption and EC key generation in Swift
body: <p>Backend uses this java implementation for encrypting the data using public key(generated from iOS App in swift),</p>
  <pre><code>        Cipher iesCipher = Cipher.getInstance(&quot;ECIESwithAES-CBC&quot;);
          byte[] derivation = Hex.decode(derivationString);
          byte[] encoding = Hex.decode(encodingString);
          byte[] nonce = Hex.decode(nonceString);
          IESParameterSpec params = new IESParameterSpec(derivation, encoding, 128, 128, nonce, true);
          iesCipher.init(Cipher.ENCRYPT_MODE, publicKey, params);
          byte[] ciphertext = iesCipher.doFinal(data.getBytes());
  </code></pre>
  <p>But in swift I could not find any equivalent library to decrypt it. I am using the <a href="https://github.com/leif-ibsen/SwiftECC" rel="nofollow noreferrer">SwiftECC</a> for generating the EC key-pair and sending the public key to server. Then server encrypts the data using that public key as mentioned in above implementation code. But SwiftECC has no any decrypt function which accepts the arguments like derivation, encoding, nonce. And I could not find anything similar to above java implementation in swift.</p>