This article includes the following:
1, cryptography Application Block of a simple introduction (refer to the English document with its own)
2, Configure Cryptography Application Block (this article to configure symmetric encryption Provider as an example, the configuration of the Hash Provider is basically similar)
3, how to encrypt a data?
4. Data decryption
5, how to get the data hash value
6, according to the data hash value to determine whether the data changes
Part One: Introduction to crytography Application Block
The Crytography Application Block provides two cryptographic methods: hash and symmetric, the difference being that the hash encryption algorithm is not decrypted, and symmetric can be encrypted and decrypted. Of course it also supports custom encryption methods, and Enterprise Library 2.0 provides the ability to modify and extend cryptographic algorithms.
When do I need to use cryptography Application Block?
When our application needs to use hash or symmetric encryption, we can consider using it, we can use the encryption algorithm provided by Microsoft, or we can define the encryption algorithm we need. When our data needs to be encrypted only, and the decryption method is not used, we can use the hash Provider (for example, if we encrypt the password), we can use the symmetric when the data need to be encrypted and decrypted. Encryption Provider (for example, we can consider using this method to encrypt data when we pass some sensitive parameters through a URL between pages).
Second, crytography Application block to our developers to bring what benefits?
1, it helps our developers to easily solve the encryption problem in the application.
2, it can help us unify the whole enterprise application uniformity.
3, crytography Application Block is extensible, we can use our own Write encryption algorithm to encrypt the application.
Part II: Crytography Application Block Configuration
First we open Enterprise Library Configuration, which exists in the bin directory with your Enterprise Library installation directory. Of course, we need to build our project first and add the app.config file, and I'll follow the example in VS2005 's Test project.
Select File--> Open application, as follows: