6.15 written examination

Source: Internet
Author: User
Tags asymmetric encryption
ArticleDirectory
    • RSA:
Symmetric encryption and asymmetric encryption

First, two terms are introduced: plaintext and ciphertext. Plaintext refers to the original data before encryption, and ciphertext refers to the encrypted data. There are two types of encryption and decryption based on different passwords.Algorithm.

(1)Symmetric encryption/decryption.

Use the same password for encryption and decryptionWhich are representative include des, blowfish, tea, and base64. Symmetric encryption and decryption is characterized by relatively asymmetric encryption and decryption, which is simple and Speed Block. It is mainly used in scenarios where a large amount of data needs to be encrypted, such as game resource file encryption.

(2)Asymmetric encryption/decryption.

Different passwords are used for encryption and decryption.Which include RSA, DSA, ElGamal, and ECDSA. The security of asymmetric encryption/decryption is based on complex mathematical difficulties. It features complex computing and slow speed. It is mainly used in financial, military, and other major confidential systems.

Why do we need asymmetric encryption and decryption? Suppose you want to send a very confidential file to your friends, and the computer of your friends is listening to the lines for communication with the outside world, including wireless signals. What should you do?

Solution A: negotiate a password with your friend in advance, then encrypt the file using the symmetric encryption algorithm, and send it to your friend. Your friend decrypts the file based on the password negotiated previously.

Use solution a to transmit encrypted confidential files, and even if the listener obtains the files, the files cannot be decrypted. It is preliminarily affirmed that solution a is valid. But what should you do if you want to transmit confidential files to multiple strangers and you cannot negotiate a password with each stranger before? In this case, asymmetric encryption is useful.

If asymmetric encryption algorithms are used to encrypt/decrypt confidential files, a stranger must first determine an encrypted password, then transmit the encrypted password to you, and tell you which asymmetric encryption algorithm he uses, you use the encrypted password to encrypt confidential files according to the specified asymmetric encryption algorithm, and transmit the encrypted files to strangers. Strangers use another password to decrypt the files after receiving the files.

In this way, even if the listener obtains the encrypted password and the encrypted file, it will not start the password file, because the files encrypted using the asymmetric encryption algorithm must be decrypted using the decryption password, the original encrypted password is invalid for decryption.

The encrypted password is opposite to the decrypted password. If the encrypted password is used for encryption, only the decrypted password can be decrypted. If the decrypted password is used for encryption, only the encrypted password can be decrypted. Therefore, they are called password pairs, one of them can be sent and published on the network, called the public key, while the other is held only by all the people in the key pair, called the private key. The private key is not transmitted in any form.

The basic principle of asymmetric encryption algorithms is that if the sender wants to send encrypted information that can only be interpreted by the recipient, the sender must first know the recipient's public key, then, the recipient's public key is used to encrypt the original text. After receiving the encrypted ciphertext, the recipient can use its own private key to decrypt the ciphertext. Obviously, using asymmetric encryption algorithms, the recipient must send the public key that has already been randomly generated to the sender before communication, while retaining the private key. Since asymmetric algorithms have two keys, they are particularly suitable for Data Encryption in distributed systems. The widely used asymmetric encryption algorithms include RSA and DSA proposed by the US National Bureau of Standards.

The asymmetric encryption system uses the public key of the other party for encryption. Only the corresponding private key can crack the encrypted ciphertext.

Asymmetric encryption algorithm for Digital SignatureProcess:
1. The sender first transforms the message using the public hash function to obtain a digital signature. Then, the sender encrypts the digital signature using the private key and sends it after the message.
2,The receiver decrypts the digital signature with the sender's public key to obtain a digital signature..
3,The receiver computes the plaintext hash function and obtains a digital signature.,If the two digital signatures are the same, the signature is valid.Otherwise, it is invalid.
Because this method is used to digitally sign the entire message, it is a fixed length of packet characteristics.CodeThe same person generates different digital signatures for different packets. Because the sender's private key is kept confidential, the receiver can reject messages based on the verification results, it can also make it unable to forge a message signature or modify the message. In this way, anyone with the sender's public key can verify the correctness of the digital signature.
It is worth mentioning that the sender's public key is published by a trusted third-party organization, namely the Certification Authority (CA.

RSA:

Generation of public and private keys

    1. Assume that Alice wants to receive Bob's private message through an unreliable media. She can generate a public key and a private key in the following ways:
      Select two large prime numbers p and q at will. P is not equal to Q and n = PQ is calculated.
      According to the Euler's function, the number of integers that are not greater than N and intersect with N is (1) (q-1)
      Select an integer e and (1) (q-1), and E is less than (1) (q-1)
      Use the following formulaComputing d: D × E limit 1 (mod P-1) (q-1 ))
      Destroy records of p and q.

(N, e) is the public key, (n, d) is the private key. (N, d) is a secret. Alice transmits her public key (n, e) to Bob and hides her private key (n, D.

Difference between processes and threads

 

1. Similarities:
()Both have IDs, registers, statuses, priorities, and scheduling policies to be followed..
(B)Each process has a process control block and a thread control block..
(C) Threads and child processes share resources in the parent process ; Threads and child processes are independent of their parent processes. Competing to use processor resources; the creator of threads and sub-processes can implement some control on the online and sub-processes, such,The creator can cancel, suspend, continue, and modify the priority of threads and sub-processes. threads and sub-processes can change their attributes and create new resources.
2. Differences:
()A thread is a part of a process. A process without threads can be considered as a single thread.If a process has multiple processes, the execution process of the process is not completed by a line (thread), but by multiple lines (threads.
(B)It takes much less time to start a thread than to start a process. In addition, the time required for switching between threads is much less than the time required for switching between processes.
(C) The system allocates different memory areas for each process during running,No memory is allocated to the thread (the resource used by the thread is the resource of the process to which it belongs), Thread groups can only share resources. For different processes, they have independent data space, and data transmission can only be performed through communication. This method is not only time-consuming, but also inconvenient. The data of one thread can be directly used by other threads, which is not only quick but convenient.
(D)Similar to the process control table PCB, the thread also has its own control table TCB, but the thread state stored in TCB is much less than that in the PCB table..
(E)A process is a basic unit for allocating all resources of the system and has a complete virtual space address.Independent of threads.

(F)When a child process is created, the address space of the parent process is copied, but the memory is not copied immediately.Copy at write time

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.