This section describes how to use the encryption and decryption module in an application, including modifying configurations to implement special tasks and howCodeFor example, encrypt data. It is assumed that you directly use the module without modification or expansion. It mainly includes the following two parts:
- Configuration Module
- Use modules in code
1. Configuration Module
1.1 right-click the configuration file and choose new> cryptography Application Block]
Fig 22.1
1.2 configure to automatically add cryptography application block nodes, and hash providers and hierarchical Ric providers, and some default settings.
Fig 22.2
1.3 configuration module
1.3.1 you can set the default hashprovider In the attribute panel on the right. The value here is the default hashprovider of the module when hash is used. 1.3.2 you can set a custom hash provider or use the hash provided by the Enterprise Library. Algorithm, The sha256managed algorithm is recommended. Figure 22.3 figure 22.4 1.3.2 The default encryption riccryptoprovider can also be set in the right-side attribute panel. 1.4 configure custom hash provider 1.4.1 In Figure 22.3 select custom hash provider 1.4.2 and click ..., the page shown in Figure 22.5 is displayed. Figure 22.5 1.4.3 configures the hash algorithm and selects a hash algorithm from figure 22.4. We recommend that you use sha256managed. 1.5 You can also add custom encryption and decryption algorithms or select the provided algorithms.