Skip to content

support AES-256-CBC for decryption #747

@alexandre-abrioux

Description

@alexandre-abrioux

First of all, thank you for maintaining this excellent library 🙂

I'm currently trying to migrate from eccrypto, and it looks like I'm not able to decrypt previously encrypted messages, possibly because eccrypto uses AES-256-CBC for ECIES instead of AES-256-GCM.

Would you consider adding support for AES-256-CBC, at least for decryption?

Test case

With the following test case:

it("test", () => {
  const privateKey = '0x4025da5692759add08f98f4b056c41c71916a671cedc7584a80d73adc7fb43c0';
  const encryptedData = '307bac038efaa5bf8a0ac8db53fd4de8024a0c0baf37283a9e6671589eba18edc12b3915ff0df66e6ffad862440228a65ead99e3320e50aa90008961e3d68acc35b314e98020e3280bf4ce4258419dbb775185e60b43e7b88038a776a9322ff7cb3e886b2d92060cff2951ef3beedcc70a';
  const data = decrypt(privateKey, Buffer.from(encryptedData, 'hex')).toString();
  expect(data).toBe('this is any data!');
})

I'm getting this error:

Error: bad point: equation left != right

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions