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

Encrypt and Decrypt Chats in The LocalChat app to prevent non users From listening In #161

Open
5enox opened this issue Jan 1, 2024 · 17 comments

Comments

@5enox
Copy link

5enox commented Jan 1, 2024

Encrypt and Decrypt messages between server and client using the private key plus something else to make it more secure.

@5enox
Copy link
Author

5enox commented Jan 1, 2024

I'd like to be assigned For This Issue

@5enox 5enox changed the title Encrypt and Decrypt Chats in The LocalChat app to prevent non users listening In Encrypt and Decrypt Chats in The LocalChat app to prevent non users From listening In Jan 1, 2024
@Ishpreet01
Copy link

@5enox is this issue still open? I would also like to contribute to it.

@5enox
Copy link
Author

5enox commented Jan 19, 2024

Yeah, sure

@Ishpreet01
Copy link

@5enox Please assign this issue to me. I would like to work on this.

@5enox
Copy link
Author

5enox commented Jan 20, 2024

@Shahrayar123 , could you please assign this issue to @Ishpreet01 ? Thank you!

@Ishpreet01
Copy link

@5enox I am not able to run the command python3 main.py in my system to set up this project. Please help me out.
Python was not found; run without arguments to install from the Microsoft Store, or disable this shortcut from Settings > Manage App Execution Aliases.-This is the message that I am getting in the terminal after running the command.

@5enox
Copy link
Author

5enox commented Jan 24, 2024

@Ishpreet01 try re-installing python, But this time check the box where it says Add to Path
also use only python main.py on windows

0_7nOyowsPsGI19pZT

or if you're on linux :
sudo apt update and then sudo apt install python3

@Ishpreet01
Copy link

@5enox I added python to path and used python main.py command to run the project. But the terminal does not display the text Anon Chat and stops working after I run the command. I am attaching the screenshot for your reference. Please tell me how to proceed further with this.

image

@Ishpreet01
Copy link

@5enox I used this command to run the Number Guessing game project and it worked perfectly for that.
image

@Harshita1375
Copy link

@5enox is this issue still open? I would also like to contribute to it.

@5enox
Copy link
Author

5enox commented Mar 26, 2024

@Harshita1375 Please Go ahead, if you need any assistance Just mention me

@Harshita1375
Copy link

@Harshita1375 Please Go ahead, if you need any assistance Just mention me

Which repository do I need to fork as I am not able to find Encrypt and Decrypt project in this repository?.

@5enox
Copy link
Author

5enox commented Mar 27, 2024

@Harshita1375 Right Here

@Sangamesh-RK
Copy link

@5enox can you assign this issue to me, i would like to contribute. I have only one question, are we decrypting the message on client side only, like end to end?

@5enox
Copy link
Author

5enox commented May 1, 2024

@Shahrayar123 Can Assign You @Sangamesh-RK , and Yes, The encryption Should Be End to end between the clients.

Here is a Starter Sample You Could Look at, using the Signal Protocol in Python ( Used By Whatsapp)

from axolotl import axolotl_curve25519 as curve
from axolotl.state import PreKeyBundle, AxolotlState

# Sender's identity key pair
sender_identity_key_pair = curve.generateIdentityKeyPair()

# Sender's pre key pair
sender_pre_key_pair = curve.generatePreKey()

# Recipient's identity key pair
recipient_identity_key_pair = curve.generateIdentityKeyPair()

# Recipient's pre key pair
recipient_pre_key_pair = curve.generatePreKey()

# Sender creates a pre key bundle to send to recipient
sender_pre_key_bundle = PreKeyBundle(sender_identity_key_pair.getPublicKey(), sender_pre_key_pair.id(), sender_pre_key_pair.getPublicKey())

# Sender encrypts a message
sender_session_builder = AxolotlState(curve.generateSenderKeyDistributionMessage(sender_pre_key_bundle, recipient_identity_key_pair.getPublicKey(), recipient_pre_key_pair.id(), recipient_pre_key_pair.getPublicKey()))
sender_session_builder.processPreKey(sender_pre_key_bundle)
cipher_text = sender_session_builder.encrypt(b"Hello, recipient!")

# Recipient decrypts the message
recipient_session_builder = AxolotlState()
recipient_session_builder.processPreKey(sender_pre_key_bundle)
recipient_session_builder.processSenderKeyDistributionMessage(cipher_text)
plain_text = recipient_session_builder.decrypt(cipher_text)

print("Decrypted message:", plain_text.decode())

Make Sure you have python-axolotl-curve25519 installed (pip install python-axolotl-curve25519) before running this code.

@Sangamesh-RK
Copy link

Make Sure you have python-axolotl-curve25519 installed (pip install python-axolotl-curve25519) before running this code.

i looked into the above module, apparently its used for E2E communication between two clients which is different from our use case, i will try to implement it for group chat but i would appreciate if you can guide me

@Sangamesh-RK
Copy link

Sangamesh-RK commented May 2, 2024

i am having a lot of import issues with axolotl module,
image
When i googled, i found out that this is a common issue for windows user. i tried following steps but wasn't able to resolve this as this requires python 2.7 but pip doesn't supports older version of Python now

can i use this module instead https://pypi.org/project/signal-protocol/ ?

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