r/javahelp • • Jan 20 '20

Encrypting messages between clients

So we have an assignment in which we have to create 5 clients that can be messaging each other, through the same port and using an interface, the only thing we can't get right, is the encryption part of the assignment. So, the messages need to be encrypted and decrypted after and before sending and recieving them. How can we do this? Any idea?

17 Upvotes

6 comments sorted by

View all comments

1

u/AryanPandey Jan 21 '20 edited Jan 21 '20

I love to have this part of the project. You can go for Java inbuilt cryptography. (There are not great, but I used it , as I don't want any external dependencies)

These library are somewhat necessary javax.crypto.* And java.util.Base64;

NOTE: For valid reasons Except RSA and AES ,all other algorithms are now Broken form this library, means they can be decrypted!

So USE only RSA and AES for quality project.

As I am not a cryptographer , I cannot help that much , I have used only the library. I can give you some practical experience. Get understanding of Base64 conversions, before getting hands on library.

I would say YOUR implementation of the library is MUST need for making it not decrypt-able easily. Otherwise, Even you choose the right library, and that could also is not matching your goals.

For precision there must be some guys trying to break your code, so that you can know what's best practices.

For some good pages I landed on web , before starting a similar project are

Don't just copy Examples as I feel they are not that great, just try to understand from them.

Except this First one. (As I loved this blog.) https://www.veracode.com/blog/research/encryption-and-decryption-java-cryptography

https://www.tutorialspoint.com/java_cryptography/java_cryptography_encrypting_data.htm

https://www.novixys.com/blog/java-aes-example/

https://www.quickprogrammingtips.com/java/how-to-encrypt-and-decrypt-data-in-java-using-aes-algorithm.html

Anything I missed, or you wanted, please comment, I will try my best to answer, if I know about that.