I'm searching the method(example) to decrypt message, that was encrypted in Bouncy castle Java library, through C# BC library.
I created ECC keypair(secp256k1 curve) in JAVA through BC library. And encrypted data with ECIES. After that, I'm able to decrypt the message easily using Java BC library. This is the example I used.
ECPublicKey key = (ECPublicKey) KeyFactory.getInstance("EC").generatePublic(new X509EncodedKeySpec(pubKey));
Cipher cipher = Cipher.getInstance("ECIES", new BouncyCastleProvider());
cipher.init(Cipher.ENCRYPT_MODE, key);
byte []encryptedString = cipher.doFinal("testmessage".getBytes("UTF-8"))
PrivateKey privateKey = KeyFactory.getInstance("EC").
generatePrivate(new PKCS8EncodedKeySpec(privKeyByte));
Cipher cipher = Cipher.getInstance("ECIES", new BouncyCastleProvider());
cipher.init(Cipher.DECRYPT_MODE, privateKey);
byte[] decrypted = cipher.doFinal(encryptedString);
I'm trying to decrypt the message using C# BC library as like I did in JAVA. But I couldn't find.
There were some examples of encryption, decryption using Bouncy castle C#. But I couldn't find to how to decrypt the message, encrypted in java bouncy castle ECIES, through C# BC library.
Please help.