Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8305909
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 8, 20262026-06-08T18:13:25+00:00 2026-06-08T18:13:25+00:00

Ok, so for fun I am coding a messenger program in Java. Fun right?

  • 0

Ok, so for fun I am coding a messenger program in Java. Fun right? 🙂

I wanted to create a messenger that worked between two PC’s tha didn’t have to consult anyone else and you just input the IP you wish to chat with. Later I would implement a user name system where you contact the server to find out their IP.

I got the AES and RSA working perfecly and then I realized that a man in the middle attack is possible when you do the public private key exchange. This kinda makes me angry…

Is there any solution to a man in the middle attack other than using a CA or having a server exchange user names and/or public private key info?

Is there any programs already made like this that I can look to?

Thanks guys!

Please note: Goal is to have secure peer to peer communication without a server. Also no vulnerabilities like man in the middle.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-08T18:13:26+00:00Added an answer on June 8, 2026 at 6:13 pm

    Basically you are asking for too much. Public keys are secure if you use them correctly. If you do a “public private key exchange” that sounds insecure. Private keys never leave the host they are generated at.

    Public keys are public and just bytes. It’s a pair of numbers!! No other information. So here you need to choose:

    1. Have a trusted third party with a shared server that associates public keys with identities. That’s called CA 🙂
    2. Exchange public keys in other secure ways. Examples: post on one’s Facebook profile (browse it with HTTPS!), meet the other person, etc.

    You might want to learn how PGP and Web Of Trust work. With WOT you can make a pretty good secure P2P chat in a social network fashion. Basically, you can still never join a P2P chat for the first time by typing an IP address, but after you do an initial work you can get a good result.

    First, obtain someone’s public key: meet him/her. By then, you can authenticate that party and he can authenticate you without possibility of attacks.

    Phase 2 consists in building a trust chain. I’ll explain that in social networking terms. You are party A, you met party B. You know each other. B knows C,D,E and later you meet F who is not known by B.

    Ask B who are his friends (and get their public keys), you get to know C, D and E and you can contact them by then. Tell B you know F and he can contact them.

    You might want to tell F about C, D and E that you know via A. This is very sensitive, because if the process is repeated indiscriminately a bad guy can easily enter the network. If you limit your trust to the “friends of friends” or up to a certain degree of indirect knowledge you can balance security.

    I proposed you this way because you told you are doing this for fun and you are not in a business scenario!!

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a function fun that returns a double. I want to call the
So I'm coding Pacman in Python just for fun and I want to create
I have started coding an FTP client application (for fun). I’m trying to represent
This is sort of two coding style questions in one. I have a tab-dl'd
Take a basic function fun<-function(){ x<-c(1,2,3,4,5) y<-c(1,2,3,4,5) t<-x+y return(t) } After I have run
I have a fun script: DECLARE @StartDT DATE DECLARE @MinDOS DATE DECLARE @TableName VARCHAR(50)
I'm having a fun issue, I have LiveReload working in Chrome, so I know
I am now starting to get back to C++ coding (just for fun), and
I have ceated several django apps and stuffs for my own fun and so
I'm trying to learn XSLT (for some holiday coding fun). I think I now

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.