2

I'm playing around with learning encryption with a mini messaging project, so far I can do symmetric encryption (AES) where everyone shares the same key, obviously not secure or ideal, I want to learn how to implement a true end-to-end encryption system. I've been told RSA is what I should use? My question is,

  • Do I generate the keys completely on the client end in javascript, or is it ok to do the key generation on the server and give them to the client?

  • Where do you store the private key in a website, is using sessions okay? Can I save the private key to localstorage?

  • Is there a good walk through with examples of implementing something in JavaScript or Python? ie, Handling key exchanges, multiple users, etc

11
  • 2
    I have an E2E chat app, written in simple JS and PHP, fully open source and documented at github.com/rndme/nadachat . There's an included security overview document that explains the very steps you're asking about. – dandavis Aug 16 '19 at 16:55
  • 1
    @dandavis awesome I'll take a look! cheers for that – Ari Aug 16 '19 at 17:44
  • 2
    @AriVictor please keep in mind that with crypto, not all code is created equal. Although dandavis should be commended for his exploration of e2e encryption and exeptional coding style, his code is not peer reviewed by researchers in the field and may contain problems that are not immediately evident – Jenessa Aug 17 '19 at 11:56
  • 1
    @Jenessa noted! this is all just a learning stage at the moment but i'll keep that in mind. – Ari Aug 17 '19 at 15:24
  • 2
    @Jenessa: I agree with that 100%. Nadachat's based on years of experience (going back to the cryptocat days), months of research, and weeks of development. The encryption core (sjcl) is well-reviewed and popular. Do keep in mind though that audits are not foolproof: whatsapp had one, yet several vulnerabilities have been found since. Nadachat's the only web-based secure chat that's fully open, front and back (afaik), and I would love an app audit (or three). In the meantime, any feedback is welcome and appreciated, thanks for speaking up. – dandavis Aug 17 '19 at 21:30
3

In true end-to-end encryption you'd generate keys for authentication on the client. The actual encryption is usually done using an algorithm which supports forward secrecy, like Diffie-Hellmann. The web is a bad form factor for this, as local storage can usually be deleted at any time.

As for your last question: there is an implementation of the Signal protocol in JS here: https://github.com/signalapp/libsignal-protocol-javascript

Your Answer

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

Not the answer you're looking for? Browse other questions tagged or ask your own question.