hotwallet / dual-crypto

Simple deterministic public key cryptography for the browser
MIT License
0 stars 0 forks source link

Use ECIES instead of AES-GCM for encryption #2

Open will123195 opened 5 years ago

will123195 commented 5 years ago

This way we'll have the ability to encrypt using a receiver's public key.

// two ways to encrypt
dc.encrypt(message)
DualCrypto.encrypt({ message, publicKey })

// decrypt
dc.decrypt(encryptedMessage)

Example: https://github.com/bitchan/eccrypto/blob/master/browser.js#L193

will123195 commented 5 years ago

here's a demo using webcrypto https://github.com/kazuki/webcrypto-ecc-sample

it just needs deterministic key generation

MannyC commented 5 years ago

Ah, so we kind of reinvented the wheel here.

However, note that this doesn't seem to be directly supported by webcrypto, but just specifies the way the the symmetric key gets derived from the asymmetric key.

For instance the second example uses aes-gcm as the symmetric algorithm: https://github.com/kazuki/webcrypto-ecc-sample/blob/master/webcrypto_supplements.ts

The standardised derivation routine is definitely a plus though