Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Need to implement #52

Open
T0RPID0 opened this issue Dec 2, 2020 · 6 comments
Open

Need to implement #52

T0RPID0 opened this issue Dec 2, 2020 · 6 comments

Comments

@T0RPID0
Copy link

T0RPID0 commented Dec 2, 2020

can u please help how can i implement this encryption and decryption algorithm in socket programming in linux, as i want to encrypt and decrypt the messages between server and client.

@AdrianChallinorOsiris
Copy link

You have a couple of challenges. I would split the encryption/decryption part from the message exchange. Get the message transfer part working for unencrypted messages first, so you can prove you have this part working.

Then move to encryption. For this you need to have a register of public keys somewhere. So you need to either make this part of your exchange protocol, or have a separate microservice that handles public keys. Either way. you will need to serialise the key and the parameters. I would go with the former and make it part of the conversation setup process:

Bare in mind that he message you send can be no longer than the key, or there abouts. This is a restriction of NTRU. Its not very good at sending very large messages. But what you can do is use the NTRU encryption process to exchange AES256 keys. Now you can send large blocks of data, encrypted with AES without having to exchange an AES key prior to this.

.> I want to communicate, here is my public NTRU key
<- OK, I accept, and here is my public NTRU key
-> [e-NTRU] : Here is my random AES256 key
<- [e-NTRU] : And here is my random AES256 key
-> [e-AES256] : Here is a secret message
<- [e-AES256] : and here is my secret response
.....

Its a matter of choice if you have two different AES keys or you share it for the life of the conversation.

Does that help? Keep in mind that you should NOT sign the messages with the NTRU private key. There is a weakness in NTRU that (partially) exposes the key in this instance. I would suggest signing in a different keyspace entirely if that is needed. YMMV

Hope this helps....

@T0RPID0
Copy link
Author

T0RPID0 commented Dec 2, 2020 via email

@Yvi71
Copy link

Yvi71 commented Dec 2, 2020 via email

@T0RPID0
Copy link
Author

T0RPID0 commented Dec 3, 2020 via email

@AdrianChallinorOsiris
Copy link

AdrianChallinorOsiris commented Dec 4, 2020 via email

@T0RPID0
Copy link
Author

T0RPID0 commented Dec 4, 2020 via email

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants