Current location - Quotes Website - Signature design - Data encryption outline
Data encryption outline
data encryption

Consider situations where users may try to bypass the system, such as physically taking the database and eavesdropping on communication lines. The most effective solution to this threat

It is data encryption, that is, storing and transmitting sensitive data in encrypted format.

The term of data encryption is: plaintext, that is, original or unencrypted data. Encrypt with an encryption algorithm, and the input information of the encryption algorithm is plaintext and.

Key; Ciphertext, the format of plaintext encryption, is the output information of encryption algorithm. The encryption algorithm is public, but the key is not public. Ciphertext, should not be none.

The key is understood by users and used for data storage and transmission.

Example: plaintext is a string:

When kingfisher caught fire.

(For simplicity, it is assumed that only uppercase letters and space characters are processed). Suppose the key is a string:

surname

The encryption algorithm is:

1) Divides plaintext into blocks with the length of the key string (spaces are indicated by "+").

Her+is on fire.

2) Replace each character of plaintext with an integer in the range of 00~26, with space character =00, A=0 1, ..., Z = 26.

0 1 1900 1 109 14070609 19 0805 18 1900 030 1200308 000609 1805

3) Replace each character of the key as described in step 2:

05 1209 1520

4) For each plaintext block, replace each character with the value after modulo 27 of the sum of the corresponding integer code and the integer code of the character at the corresponding position in the key:

5) Replace the integer code in the result of step 4 with equivalent characters:

FDIZB SSOXL MQ+GT HMBRA ERRFY

If the key is given, the decryption process of this example is simple. The problem is that for a malicious attacker, without knowing the key, a matching

How difficult is it to obtain the key of plaintext and ciphertext? For the simple example above, the answer is quite easy, not easy in general, but a complex encryption mode.

Formulas are also easy to design. Ideally, the encryption mode adopted should make the attacker pay more for cracking than he gains. solid

In fact, this purpose applies to all security measures. The ultimate acceptable goal of this encryption model is that even the inventor of this model can't pass the stage.

The key is obtained by plaintext and ciphertext, so it is impossible to crack the ciphertext.

1. data encryption standard

There are two traditional encryption methods, replacement and permutation. The above example uses another method: using a key to convert each character in the text into a secret.

A character in the text. Substitution simply rearranges the characters of plaintext in a different order. Neither method is safe to use alone, but

The combination of these two methods can provide quite high security. Adopt data encryption standard (DES).

This combination algorithm was formulated by IBM and became the official encryption standard in the United States in 1977.

DES works as follows: plaintext is divided into many 64-bit blocks, and each block is encrypted with a 64-bit key. In fact, the key consists of 56 bits of data and 8 bits.

Parity bits, so there are only 256 possible passwords instead of 264. Each block is encrypted by the initial permutation method, and then repeated 16 times.

Replace, and finally apply the inverse of the initial replacement to it. The substitution in step I does not directly use the original key K, but uses the key Ki calculated by K and I. ..

DES has the characteristic that its decryption algorithm is the same as the encryption algorithm except that the key Ki is applied in the reverse order.

2. Public key encryption

For many years, many people thought DES was not really safe. In fact, with the emergence of fast and highly parallel processors, even without intelligent methods.

Now, it is also possible to crack DES by force. The "public key" encryption method makes DES and similar traditional encryption technologies obsolete. In the public key encryption method, encryption

The algorithm and encryption key are public, and anyone can convert plaintext into ciphertext. But the corresponding decryption key is secret (the public key method includes two keys,

Respectively used for encryption and decryption), and can not be deduced from the encryption key, so even the encryptor can not decrypt it without authorization.

The idea of public key encryption was first put forward by Diffie and Hellman, among which Rivest, Shamir and Adleman were the most famous. Now it is usually called

RSA (named after the initials of three inventors) is based on two facts:

1) There is a fast algorithm to judge whether a number is a prime number;

2) A fast algorithm for determining the prime factor of a composite number has not been found.

The RSA method works as follows:

1) Choose two different big prime numbers p and q at will and calculate the product r = p * q;;

2) Choose a large integer e at will, e is coprime with (p- 1)*(q- 1), and the integer e is used as the encryption key. Note: the choice of e is easy, for example, they are all big.

Both p and q have prime numbers.

3) determine the decryption key d:

D * e = 1 module (p-1)*(q-1)

D can be easily calculated from e, p and q.

4) disclose the integers r and e, but not d;

5) encrypt plain text p (assuming that p is an integer less than r) into cipher text c, and the calculation method is as follows:

C = Pe module r

6) Decrypt the ciphertext c into plaintext p, and the calculation method is as follows:

P = Cd module r

However, it is impossible to calculate d only from r and e instead of p and q. Therefore, anyone can encrypt plaintext, but only authorized users (know D).

Before the ciphertext is decrypted.

Let's give a simple example to illustrate the above process. Obviously, we can only choose a very small number.

Example: if p = 3 and q = 5, then r= 15, (p- 1)*(q- 1)=8. Choose e= 1 1 (a prime number greater than p and q) and use d *11=1moduo8.

Calculate d =3.

Suppose the plaintext is an integer of 13. Then ciphertext c is

C = Pe module r

= 13 1 1 module 15

= 1, 792,160,394,037 15

= 7

The recovered plaintext p is:

P = Cd module r

= 73module 15

= 343 mode 15

= 13

Because e and d are reciprocal, the public key encryption method also allows the encrypted information to be "signed" in this way, so that the receiver can be sure that the signature is not forged.

Suppose A and B want to transmit data through public key encryption, and A and B disclose the encryption algorithm and the corresponding key respectively, but not the decryption algorithm and the corresponding key.

The encryption algorithms of A and B are ECA and ECB, the decryption algorithms are DCA and DCB, ECA and DCA are reciprocal, and ECB and DCB are reciprocal.

If A wants to send plaintext P to B, it does not simply send ECB(P), but first applies its decryption algorithm DCA to P, and then encrypts the result with the encryption algorithm ECB and sends it out.

Ciphertext c is:

C = European Central Bank

After receiving C, B applies its decryption algorithm DCB and encryption algorithm ECA in turn to obtain plaintext P:

ECA

= ECA(DCB(ECB(DCA(P)))

= ECA(DCA(P)) /*DCB and ECB cancel each other out */

= P /*DCB and ECB cancel each other out */

In this way, B can determine that the message is indeed sent from A, because only when DCA algorithm is used in the encryption process can P be obtained by ECA, and only A knows DCA algorithm.

Some people, even B, can't forge A's signature.