Original address: http://www.cnblogs.com/jifeng/archive/2010/11/30/1891779.html
The workflow of the SSL protocol:
Server Authentication phase: 1) The client sends a start message "Hello" to the server to start a new session connection; 2) The server determines whether a new master key needs to be generated based on the customer's information and, if necessary, the server will contain the information needed to generate the master key when responding to the customer's "Hello" information ; 3) The customer generates a master key based on the received server response information, encrypts it with the server's public key and transmits it to the server; 4) The server recovers the master key and [edit classification] returns to the customer a message authenticated with the master key, which allows the client to authenticate the server.
User authentication phase: Prior to this, the server has passed the customer certification, this phase is mainly to complete the customer certification. The certified server sends a question to the customer, and the customer returns a (digital) signature question and its public key, thereby providing authentication to the server.
From the service provided by the SSL protocol and its workflow, it can be seen that the SSL protocol runs on the basis of the merchant's commitment to the confidentiality of consumer information, which is beneficial to the merchant and not the consumer. In the initial stage of e-commerce, because the operation of e-commerce enterprises are mostly reputable large companies, so this problem has not been fully exposed. However, with the development of e-commerce, small and medium-sized companies are also involved, so that in the electronic payment process of the single certification problem is more and more prominent. Although the authentication of both the browser and the Web server can be achieved through digital signature and digital certificate in SSL3.0, there are still some problems with the SSL protocol, for example, it can only provide the mutual authentication between the client and the server in the transaction, and the SSL protocol does not coordinate the secure transmission and trust relationship between the parties in the electronic transactions involving multi-party. In this case, the two major credit card organizations, Visa and MasterCard, set up a set agreement that provides a global standard for online credit card payments.
handshake process for SSL protocol
To facilitate a better understanding and understanding of the SSL protocol, this article focuses on the SSL protocol Handshake protocol. The SSL protocol uses both public-key cryptography (asymmetric encryption) and symmetric encryption technology, and SSL encrypts the transmitted content with symmetric encryption, and then uses the public key to encrypt the symmetric encryption key. The advantage of this is that symmetric cryptography is faster than public-key cryptography, can be used to encrypt large transmission content, and public-key cryptography is relatively slow, providing better authentication techniques that can be used to encrypt the keys used by the symmetric encryption process.
The SSL handshake protocol is very effective in enabling mutual authentication between the client and the server, and the main process is as follows:
The browser of the ① client transmits the version number of the client SSL protocol to the server, the type of cryptographic algorithm, the random number generated, and the various information needed to communicate between the server and the client.
The ② server transmits the version number of the SSL protocol to the client, the type of encryption algorithm, the random number, and other related information, and the server also transmits its own certificate to the client.
③ customers use the information sent by the server to verify the legitimacy of the server, the legitimacy of the server includes: whether the certificate expires, the issuing server certificate of the CA is reliable, the publisher certificate's public key can correctly unlock the server certificate "publisher's digital signature", the server certificate on the domain name and the server's actual domain name match. If the legitimacy verification is not passed, the communication will be disconnected, and if the legitimacy validation passes, the fourth step will continue.
The ④ client randomly generates a "symmetric password" for subsequent communication, encrypts it with the server's public key (obtained from the server's certificate in step ②), and then passes the encrypted "pre-master password" to the server.
⑤ If the server requires a customer's authentication (optional during the handshake), the user can create a random number and then sign the data to the server with the random number of signatures, along with the client's own certificate and the encrypted "pre-master password".
⑥ If the server requires customer authentication, the server must verify the legitimacy of the client certificate and the signature random number, the specific legality verification process includes: whether the customer's certificate use date is valid, to provide a certificate to the client CA is reliable, the issuing CA's public key can correctly unlock the client certificate of the issuing CA's digital signature, Check that the client's certificate is in the certificate revocation list (CRL). If the test is not passed, the communication is interrupted immediately; If authenticated, the server will use its own private key to unlock the encrypted "master password" and then perform a series of steps to generate the primary communication password (the client will also generate the same master communication password in the same way).
⑦ server and client use the same master password as the "Call password", a symmetric key for the SSL protocol of Secure data communication encryption and decryption communication. At the same time in the process of SSL communication to complete the integrity of data communication, to prevent any changes in data communication.
The ⑧ client sends a message to the server that indicates that subsequent data traffic will use the master password in the ⑦ as the symmetric key, and notifies the server client that the handshake process is complete.
The ⑨ server sends a message to the client indicating that the subsequent data traffic will use the master password in the ⑦ as the symmetric key, and notifies the client that the server side of the handshake process is complete.
⑩ssl The handshake part ends, the SSL secure channel data communication begins, the client and the server begin to use the same symmetric key for data communication, while the integrity of the communication test.
The specific process of two-way authentication SSL protocol
The ① browser sends a connection request to the secure server.
The ② server sends its own certificate, along with the information associated with the certificate, to the customer's browser.
③ the client browser checks if the certificate sent by the server is issued by the CA center that you trust. If it is, continue to execute the agreement; if not, the customer's browser gives the customer a warning message: Warn the customer that the certificate is not trustworthy and ask the customer if they need to continue.
④ then the client browser compares the messages in the certificate, such as the domain name and the public key, whether the message that the server has just sent is consistent, and if it is consistent, the client's browser recognizes the legitimate identity of the server.
The ⑤ server requires customers to send their own certificates. Upon receipt, the server verifies the client's certificate and denies the connection if it is not authenticated, and if authenticated, the server obtains the user's public key.
The ⑥ client browser tells the server that it can support a symmetric password scheme for communication.
⑦ server from the customer sent over the password scheme, select a cryptographic scheme of the highest encryption, with the customer's public key after the notification browser.
⑧ Browser for this password scheme, select a call key, and then use the server's public key to be sent to the server.
The ⑨ server receives the message sent by the browser, decrypts it with its own private key, and obtains the call key.
⑩ server, browser Next communication is a symmetric cipher scheme, symmetric key is over-dense.
Described above is the two-way authentication SSL protocol specific communication process, this situation requires both the server and the user has a certificate. The one-way authentication SSL protocol does not require the customer to have the CA certificate, the specific process is relative to the above steps, only need to remove the server-side validation of the client certificate, and in the negotiation of symmetric password scheme, symmetric call key, the server sent to the customer is no encryption (this does not affect the SSL process security) password scheme. In this way, the two sides of the specific communication content, is to add over the dense data, if there is a third-party attack, access to only encrypted data, the third party to obtain useful information, it is necessary to decrypt the encrypted data, this time the security depends on the security of the password scheme. Fortunately, the current cipher scheme, as long as the communication key length is long enough, is sufficient security. This is why we emphasize the need to use 128-bit encrypted communication
SSL protocol (HTTPS) handshake, workflow detailed (bidirectional HTTPS process)