[crypto] Chat with Diffie-Hellman and AES-256-CBC

91 views
Skip to first unread message

Fernando Gabrieli

unread,
Oct 11, 2017, 1:44:56 PM10/11/17
to nodejs
Hello all, i'm working on implementing a chat with encryption which uses Diffie-Hellman for exchanging a key first and then AES-256-CBC for symmetric encryption. Is anyone interested in contributing/auditing? :-) If so, i can pass the repo

thanks,
Fernando

Mikkel Wilson

unread,
Oct 11, 2017, 8:50:38 PM10/11/17
to nodejs
Fernando, 

I have some experience with these protocols and tools and could help with an audit.

I would suggest you also look at the fine work that's been done recently by the Keybase team in building their secure chat application: https://keybase.io/blog/keybase-chat. They're using symmetric keys instead of stream ciphers, but the results may be similar.

Mikkel

Fernando Gabrieli

unread,
Oct 12, 2017, 3:13:06 PM10/12/17
to nodejs
Hi Mikkel, thank you very much. Seems like they have a much more advanced app than mine.



- https://bitbucket.org/fgabrieli/cryptochat/ also has instructions for installing to audit that i wrote for you :-)


What i want to achieve is a free open source backdoor-free app which provides encryption for peer to peer communication.


- The most important files are CryptoSocketProxy.js and DHMessage.s

CrypoSocketProxy is a Proxy() instance for net.Socket such that it will automatically exchange a key with the other peer using Diffie-Hellman to encrypt later with AES-256-CBC.

- For key generation and encryption im using crypto from nodejs provided openssl installed.

- For Diffie-Hellman i have four states (this is something i did, maybe there is a paper written already with the states to use):

const DH_STATE = {
 NOT_CONNECTED: 'NOT_CONNECTED',
 WAITING_FOR_SECRET: 'WAITING_FOR_SECRET',
 CONNECTED: 'CONNECTED'
}

- A good place to start looking at the code, maybe as entry point would be Client.js, line 27, this.connect()

    When socket('connect') it will send the common share and secret to the other peer and wait for it's secret to computer the symmetric key later


thanks a lot for taking the time to help me!!!
Fernando
Reply all
Reply to author
Forward
0 new messages