Linux - Security This forum is for all security related questions.
Questions, tips, system compromises, firewalls, etc. are all included here. |
Notices |
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
Are you new to LinuxQuestions.org? Visit the following links:
Site Howto |
Site FAQ |
Sitemap |
Register Now
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
|
 |
06-12-2008, 05:03 AM
|
#1
|
Member
Registered: Oct 2005
Distribution: Ubuntu
Posts: 165
Rep:
|
Public key, private key explained
Hello,
I'm trying to understand how encryption and authentication work. I read that for the case of a web site and an SSL certificate, let's take the example of you buying from Amazon, there is a private key that only Amazon knows, and the Amazon.com public key that anyone can get. So you access https://www.amazon.com, the web site sends you its public key, and its web page encrypted using their private key. Using the public key, you know it came from Amazon and you can read the content of the HTML file. Ok. But if between my computer and the Amazon servers, there is some one who snifs the packets sent back and forth, he knows I'm visiting Amazon, he also knows the public key, and therefore, he can intercept HTML data and decrypt it using the public key, right? Then it's not secure. Or am I missing something? 
Thanks,
|
|
|
06-12-2008, 05:14 AM
|
#2
|
LQ Guru
Registered: Mar 2006
Location: Sydney, Australia
Distribution: Fedora, CentOS, OpenSuse, Slack, Gentoo, Debian, Arch, PCBSD
Posts: 6,678
Rep: 
|
That's why certificate authorities come into play.
What you are suggesting works, but is hard, because unless I know what encrypted sites you plan to visit, the middleman would need to create a certificate on the fly which takes time. But what you describe it the classic middleman vulnerability
|
|
|
06-12-2008, 05:19 AM
|
#3
|
Member
Registered: Oct 2005
Distribution: Ubuntu
Posts: 165
Original Poster
Rep:
|
Thanks. If the middle man reads the information sent back and forth, he knows what site the victim is visiting, right? So he can decrypt the information sent by Amazon using the Amazon public key. Or am I missing something? For what purpose would he have to create a certificate on the fly? What kind of certificate would it be?
|
|
|
06-12-2008, 05:23 AM
|
#4
|
LQ Guru
Registered: Jul 2003
Location: Los Angeles
Distribution: Ubuntu
Posts: 9,870
|
Quote:
Originally Posted by billymayday
That's why certificate authorities come into play.
What you are suggesting works, but is hard, because unless I know what encrypted sites you plan to visit, the middleman would need to create a certificate on the fly which takes time. But what you describe it the classic middleman vulnerability
|
The thing is, what he described is totally erroneous. Additionally, you don't need to have any prior knowledge of what sites the victim will be using or anything like that. Creating fake certificates is a piece of cake, and if it wasn't for a trusted third-party (the CA), there would be no way to know with a fair degree of certainty that the server's certificate actually belongs to it. So yes, checking for properly signed certificates protects you from a man-in-the-middle attack, but the attacker having prior knowledge of the sites is irrelevant - as it should be.
Quote:
Originally Posted by calande
I'm trying to understand how encryption and authentication work. I read that for the case of a web site and an SSL certificate, let's take the example of you buying from Amazon, there is a private key that only Amazon knows, and the Amazon.com public key that anyone can get. So you access https://www.amazon.com, the web site sends you its public key, and its web page encrypted using their private key. Using the public key, you know it came from Amazon and you can read the content of the HTML file. Ok. But if between my computer and the Amazon servers, there is some one who snifs the packets sent back and forth, he knows I'm visiting Amazon, he also knows the public key, and therefore, he can intercept HTML data and decrypt it using the public key, right? Then it's not secure. Or am I missing something?
|
That's not how it works. The client connects to the HTTPS server, and the server provides the client with a certificate (which includes the server's public key). The client verifies that the certificate is good (in other words, that it is digitally signed by a trusted third party), then proceeds to encrypt a random session key using the server's public key and sends it to the server. The session key is used from then on to secure the connection for that session. Keep in mind that only the server can decrypt content encrypted with its public key (you need the private key to decrypt it). If you Google for something like how does HTTPS work (or maybe how does SSL work) you should be able to find tons of info.
Quote:
Originally Posted by calande
But if between my computer and the Amazon servers, there is some one who snifs the packets sent back and forth, he knows I'm visiting Amazon, he also knows the public key, and therefore, he can intercept HTML data and decrypt it using the public key, right?
|
No. He needs the private key in order to decrypt.
Last edited by win32sux; 06-12-2008 at 01:01 PM.
|
|
|
All times are GMT -5. The time now is 12:47 PM.
|
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.
|
Latest Threads
LQ News
|
|