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

Lack of raw encrytion using public key only and raw decryption using private key only #20

Open
xuancong84 opened this issue Mar 26, 2021 · 4 comments

Comments

@xuancong84
Copy link

It is quite exciting to an open-source implementation of curve25519 encryption, thanks a lot to the authors. However, in this implementation, I could not find any function that does raw encryption using only the public key, nor raw decryption using only the private key.

The key idea of asymmetric cryptography is the ability to distribute only the public key and allow the public side to only encrypt but not decrypt. However, for the Box(private_key, public_key) method, you need to distribution both the public and private key, in this way the other party can use it to both encrypt and decrypt, so information is no longer secure, defeating the core purpose of asymmetric cryptography.

@atoulme
Copy link

atoulme commented Mar 26, 2021

Would you like to try Apache Tuweni? We have implemented Box too. I’d be grateful for any feedback.

@neilalexander
Copy link
Owner

However, for the Box(private_key, public_key) method, you need to distribution both the public and private key, in this way the other party can use it to both encrypt and decrypt, so information is no longer secure, defeating the core purpose of asymmetric cryptography.

You're supposed to provide the box function with your private key and their public key.

@xuancong84
Copy link
Author

xuancong84 commented Mar 29, 2021

You're supposed to provide the box function with your private key and their public key.

Thanks for your reply! But since internally Box() computes a shared key from Alice's private key and Bob's public key, and the internally computed shared key for Box(Alice's private key, Bob's public key) is the same as Box(Bob's private key, Alice's public key). As a result, even without Bob's private key, one can decrypt Bob's message using Bob's public key and Alice private key, and Alice cannot encrypt Bob's message just using Bob's public key, she has to use her own private key. This way, it makes the encryption completely symmetric. Every time, you have to distribute the key pair to the other party, and with that key pair, everyone can both encrypt and decrypt all messages. This defeats the original purpose of asymmetric encryption, posing a major security risk.

The original asymmetric encryption does not work this way because even though some 3rd party steal Bob's public key, they cannot decrypt Bob's message. Now because the keys are always distributed in pairs, hacker can steal the key pair and decrypt both Alice and Bob's messages; moreover, hacker can also encrypt Alice and Bob's messages and successfully fake all messages.

@krishnangovindraj
Copy link

I know the comment is 2 years old, but I had a different understanding.
Bob and Alice only exchange public keys with each other. The private keys remain secret.
If Bob uses his own private key and Alice's public key to compute the shared key, Whoever wants to decrypt needs Bob's public key AND Alice's private key to be able to decrypt it.
Please correct me if I'm missing something.

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

4 participants