用镜头记录,用心灵体验 | 订阅本站 | 所有笔记 | 亲和力设计 | 流量

DB2 学习笔记

博客话题:DB2,Linux,Web,业余无线电,户外,摄影,截拳道,Thankpad,其他

Web

Secure communication on both direction by HTTPS

目录

  1. HTTPS Overview 
  2. What is PKI?
  3. How does SSL work?
  4. Reference

HTTPS Overview 

Let's have an overview on HTTPS.

|        HTTPS
|        /  \ 
|    HTTP    SSL    SET
|              \   /
|               PKI

HTTPS is based on HTTP protocal and SSL protocal.

SSL protocal is an implement of PKI standard.

What is PKI?

To discuss HTTTS, we are better to know what PKI is first. It's very important! Here's an article talking about PKI in detail.

PKI, Public Key Infrastructure, is attend to insure the data security transfered over Internet and identify the authentic user.

The public key for ones could be obtained by everyone on Internet, the private key is only kept by the owner. Signing with the public key will insure the data security. Signing with the private key will insure the undeniable.

So it requires both side have theire own keys for insuring secure communication on both direction. However in some situation, it's not easy to get keys on both side, such as B2C, you can't require each visiter getting their keys for using your website.

How does SSL work?

Is there a way to have secure communication both direction without requiring keys on the browser side? The answer is yes, there's SSL. Below's a section from the article Introduction to SSL that describes how SSL works very clearly.

The SSL protocol uses a combination of public-key and symmetric key encryption. Symmetric key encryption is much faster than public-key encryption, but public-key encryption provides better authentication techniques. An SSL session always begins with an exchange of messages called the SSL handshake. The handshake allows the server to authenticate itself to the client using public-key techniques, then allows the client and the server to cooperate in the creation of symmetric keys used for rapid encryption, decryption, and tamper detection during the session that follows. Optionally, the handshake also allows the client to authenticate itself to the server.

Below is brief steps for SSL Handshake(assume it's between Internet Browser and web server.)

Browser side (no keys)          <----->         Server with SSL (keys based on PKI)
--
B   ->  hello, wanna a secure connection                    ->  S
B   ->  my ssl version                                      ->  S
B   ->  my encrypt type                                     ->  S
B   ->  some random data                                    ->  S
B   ->  hello done                                          ->  S
--
B   <-  hello, yeah, i accept                               <-  S
B   <-  some random data                                    <-  S
B   <-	my certificate including my pub-key                 <-  S
B   <-  hello done                                          <-  S
--
B   verify the certificate                                      S
B   generate "premaster secret"                                 S
B   ->  "premaster secret" encrypted with server's pub-key  ->  S
B   generate "master secret" by "premaster secret"              S
B   generate "session keys" by "master secret"                  S
B   ->  I'll send data encrypted by "session keys" at next  ->  S
B   ->  encrypted "I'm ready"                               ->  S
--
B   decrypt "premaster secret" with server's priv-key           S
B   generate "master secret" by "premaster secret"              S
B   generate "session keys" by "master secret"                  S
B   <-  I'll send data encrypted by "session keys" at next  <-  S
B   <-  encrypted "I'm ready"                               <-  S
--
Handshake is finished.

For the steps above, it's not for the case of server reqests the client authenication. Here only discuss the case of none-keys on client side.

We know the keys on server side is only used for exchanging the session key. The session key is the symmetric key that is acctrually used to encrypt/decrypt data between client and server.

I'm not sure how related between the browser and server's random data at their first hello step. At browser generates "premaster secret", it might base on the random data from server. it's my guess. Anyone could give the steps more clear?


Reference

 

Alex's picture

my email address in picture

搜索|Search

评论|Recent Comments

按月归档|By Month

2009
07
2008
11
10
07
05
04
03
02
01
2007
12
10
07
06
05
04
03
02
01
2006
12
11
10
09
08
07
06
05
04
03
02
01
2005
11
10
09
08
07
04
03
2004
12
11
10
09
08
07
06
05
04
03
02
01
2003
12
10
09
08
06
2002
09
08
04
03
02
2001
12
09
07
06
05

我读|My Books

我的链接|My Links

我的朋友|My Friends

Creative Commons License
This blog is licensed under a Creative Commons License.
Movable Type 4 Logo