Поделиться через


Modifying the Cryptography Application Block

The Cryptography Application Block was designed to be used in a variety of applications and to be a general-purpose cryptography application block. Extension points let you adapt the block to suit the requirements of any particular application. However, if you want to add new features to the block, you can do so by modifying the source code (the block includes both the source code and the binaries).

Note

When modifying the source code, you should follow good practices described in the topic Extending and Modifying Enterprise Library.

Modifying the Key Management Code

Enterprise Library implements a DPAPI-based approach to key management. You can use this implementation, or you can follow its model and adapt the code to meet the key management requirements of your organization. Use the following guidelines to modify the block source code to implement a custom key management solution:

  • Modify the KeyManager class. The block runtime uses the KeyManager class to read and write keys. This class is located in the Security.Cryptography project.
  • Modify or replace the Cryptographic Key Wizard source code. This wizard is a part of the Cryptography Application Block design-time component. You can find the source code for the wizard in the Security.Cryptography.Configuration.Design project.
  • Modify the design-time source code that executes the Cryptographic Key Wizard. The configuration tools execute this wizard when you add a keyed hash algorithm provider or add a symmetric algorithm provider to your application configuration.

More Information

For related information, see the following resources: