Cryptographic systems and the. NET Framework

Source: Internet
Author: User
Tags generator hash

Security is the key to many applications. Providing authentication and authorization services is only part of the entire security system. What happens when the data is used and transmitted in the application system? That's why cryptography comes about. Cryptography is a big topic in itself. In the following article, we'll just discuss the. Net framework and the cryptographic classes it provides.

Why use the encryption system?

Most application systems provide security features such as login boxes, role-based authentication, and so on. But what if some people intercept the data in the network? Or someone falsifying data that's being transmitted online? What if someone opens a database that stores passwords? The cryptography system will provide us with a way to solve the problem. With the. NET Framework encryption class, you can encrypt the data that flows in your system and then decrypt the data when the authenticated user needs to read or modify it. In short, the cryptography system has the following characteristics:
。 Protects data from third party reads
。 Protect data from other parties
。 Ensure data arrives at destination correctly

Type of password class:

The available encryption types in. Net framwork include the following:

。 Key Encryption Class
。 Public Key Cryptography Class
。 Digital Signature Class
。 Hash Encryption class
All cryptographic-related classes can be found in the System.Security.Cryptography namespace.

= Key Encryption =
In key encryption, the data is encrypted by a unique key. This key is only known to the recipient and sender of the information. The sender uses the key encryption and the receiver decrypts with the same key.

The. NET Framework provides several classes that handle key encryption.
: Public Key cryptography:
Unlike key encryption, public key cryptography uses two keys. One is called the public key and one is the private key. The public key is public, and the private key is kept by the owner of the key. Data encrypted by the key can only be decrypted by the corresponding public key. Similarly, data that is encrypted by the public key can only be untied by the corresponding private key.
Naturally, to encrypt the data you want to transmit, you need to use a public key. And it can only be solved by the corresponding private key.

The. NET Framework provides the following classes for handling public key cryptography.


= = Digital Signature = =

Digital signatures are used to confirm the identity of the sender and ensure the integrity of the data. It is often used in conjunction with public key encryption. Digital signatures work as follows:

。 The sender uses a hashing algorithm to produce a summary of the information to be sent, a brief description of the data to be sent.
。 The sender uses a private key to encrypt the information digest to obtain a digital signature.
。 The sender sends the data through a secure channel.
。 The receiving party receives the data and decrypts the digital signature using the public key to retrieve the information digest.
。 The receiver applies the same hashing algorithm to create a new information digest.
。 If the sender's summary of information is consistent with that of the recruiting party, the information is from the correct place.

DSACryptoServiceProvider and RSACryptoServiceProvider classes are used to create digital signatures.

Hash encryption = =

The hash algorithm creates a fixed length output for a given variable length of data. If the source data changes, a different hash value is generated. It is often used in conjunction with digital signatures.

. The following several hash classes are available in net.


Random number generator

In a cryptographic system, you may need to generate a key multiple times, and a random number generator can satisfy the requirements. RNGCryptoServiceProvider produces such random numbers in. Net.
The next article will introduce the use of several classes of key encryption

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: 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.