Web encryption, decryption learning Notebook

Source: Internet
Author: User

Remember the first time you signed up for a Taobao account and purchased a payment online. After the purchase of a good item, click on the payment, the browser will jump to "https" the beginning of the page link, and then enter the bank card payment password to complete the payment of the product. At that time only to know that the link beginning with HTTPS is an encrypted security link, and the password entered in this webpage is encrypted and then transmitted in ciphertext, so the password cannot be peered.

now, the HTTPS this security link involved in the computational knowledge and work principle also has a certain understanding, but never done the systematic collation, now through learning and record the way, a good comb this knowledge.


I. Objectives of the Security network

1.1 Confidentiality of data

Confidentiality is to prevent data from being read unauthorized. So the sender and receiver of the data should encrypt the data with some kind of encryption mechanism, and the data transmitted by both sides is the ciphertext after being processed.

1.2 integrity of data

Integrity is to prevent unauthorized modification of data, or at least a mechanism to detect that the data has been modified.

1.3 availability of data

usability is primarily for the party providing the service, and when the server is under a denial of service (dos) attack, the availability of the resources used is reduced or the information is not available at all.


II. Security Protocols

2.1 SSL

The SSL (secure Socketlayer) Secure Sockets Layer protocol is a protocol for securely exchanging data between a Web browser and a server. There are V1,V2,V3 three versions,V3 version is currently used.

2.2 TLS

TLS (Transport layersecurity) Transport Layer Security protocol. There is a V1 version, similar in functionality to SSL V3 .

in the Internet model SSL/TLS the protocol works in the application layer and TCP layer, the application layer of data is no longer sent directly to the transport layer, but sent to SSL layer, through SSL after encryption, the next step is processed.

650) this.width=650; "src=" http://s3.51cto.com/wyfs02/M01/57/56/wKioL1SYMfCCAJCoAALgVxgN9dQ145.jpg "title=" capture. PNG "alt=" Wkiol1symfccajcoaalgvxgn9dq145.jpg "/>

Third, the encryption method

3.1 Symmetric encryption ( ensure the confidentiality of data, that is, to convert plaintext into unreadable ciphertext )

Encrypted decryption uses the same password, that is, the encryption key is the same as the decrypted key, and the encryption key gets decrypted

Secret key. It is mainly used to guarantee the confidentiality of data. The security of the key becomes the key to this type of encryption.

3.1.1 DES ( Data Encryption Standard ) Data Encryption Standard, also known as Data encryption algorithm, this kind of encryption algorithm

The material principle is determined by The idea of cyclic shifting.

3.1.2 3DES Triple DES is a DES the variant, which is DES , which increases the length of the encryption key, DES of the

About bit added to the 168 bit.

3.1.3 AES ( Advanced Encryption standard ) Advanced Encryption Standard, also an advanced encryption algorithm

3.2 Asymmetric Encryption (non-symmetric encryption algorithm encrypts the symmetric key with the public key to ensure the key is secure during key exchange)

Asymmetric encryption system involves a set of key pairs, a public key, called the public key ( publickey privatekey

3.2.1 Asymmetric Encryption algorithm

Rsa

Dsa

Dss

Ecc

3.3 One-way encryption (guarantees data integrity)

one-way encryption can only be encrypted from plaintext, and cannot be decrypted from ciphertext into plaintext.

3.3.1 Encryption Algorithm

MD5

SHA1,SHA256,SHA512,SHA3

Hmac

3.3.2 One-way encryption feature

fixed-length output: The encrypted output is a fixed-length data regardless of the size of the encrypted data.

Avalanche Effect: When the original source data is changed slightly, the output of the encryption will change greatly.

In the actual application, these three kinds of encryption methods often do not use alone, generally are combined to achieve the safe transmission of data. What is the complete data communication process in the network? The simple description is as follows:

Sender:

1, the sender uses the selected one-way encryption algorithm to calculate the source data signature;

2, the sender uses their own private key to encrypt this signature, and the encrypted ciphertext data appended to the source data ;

3. The sender generates a one-time symmetric key and encrypts the data using this key (source data + ciphertext data after cryptographic signature)

4, the sender uses the receiver's public key to encrypt the one-time symmetric key, and attaches to the encrypted data behind;

5 . The data is ready to start sending data.

Receiving Party:

1. The receiver uses the private key that is paired with the public key to decrypt the data, and can obtain a one-time symmetric key;

2, using a one-time symmetric key to decrypt the data, you can get the source data and encryption code after the ciphertext data;

3, using the sender's public key to decrypt the data, to obtain the source data and the source data characteristic code;

4, using the same one-way encryption algorithm with the sender to recalculate the source data signature, and the decrypted signature comparison, if the signature is the same, the resulting source data is trustworthy, otherwise, the source data is not trustworthy.


PS: The character of the word is always a bad memory, now upload notes made with Xmind.


This article is from the "SNAIL" blog, make sure to keep this source http://357742954.blog.51cto.com/368705/1592871

Web encryption, decryption learning Notebook

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.