I was trying to encrypt data with Ethereum Key pairs. So far, I have managed to encrypt and decrypt data with these keys using ECIES schema on eth-crypto. Eth-crypto is a package which is built on top of ec-crypto. I can derive public-key on eth-crypto. And also, I have managed to derive keys using Cava library which is implemented by Consensys.

const EthCrypto = require('eth-crypto');

const privKey = "0xd9c3501c110a83bb22c319e4c50b9169f2fee017d98dc22c9af624adb6f10130";
//const pubKey = "4f3fc0bebdeeeffd0d94afa321d8d3f8b3373a6910438842bde9808cffef0ccc261b5b5171c730a164e4d4108927e6e18fb757f81d2d4234e7cc14e2507c49ba";
const message = "testMessage"

const derivedPublicKey = EthCrypto.publicKeyByPrivateKey(testPriv

async function main() {

    const encrypted = await EthCrypto.encryptWithPublicKey(
        pubKey, // publicKey
        message // message


    const decryptedMessage = await EthCrypto.decryptWithPrivateKey(
        privKey, // privateKey  
        // encrypted-data

What I need is to be able to decrypt/encrypt with the same algorithm which can be shown as secure. The encryption pattern used in ethereumJ gives me the 'Bad MAC' error. So that, I have left it for a while, and try to build on Cava. My aim is to generate the ciphers that can be decrypted both on Android/iOS/Web. Is there any library that can guide me or should I implement these encryption patterns for both Swift and Java/Kotlin ?

PS : ec-crypto uses AES-256-CBC as symettric encryption ECIES.

As I could not get any answer from the community, We have implemented ECIES for ethereum wallet on top of bouncycastle. You can review and provide feedback and may also contribute to the project on GitHub. I will provide documentation for package ASAP.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.