Adding Application Code

Retired Content

This content is outdated and is no longer being maintained. It is provided as a courtesy for individuals who are still using these technologies. This page may contain URLs that were valid when originally published, but now link to sites or pages that no longer exist.

The latest Enterprise Library information can be found at the Enterprise Library site.

The Cryptography Application Block is designed to support common scenarios for symmetric encryption and hashing. When you add your application code, refer to the scenarios in Key Scenarios and select the ones that best suit your situation. Use the code that accompanies the scenario either as it is shown here or adapt it as needed.

To prepare your application

  1. Add a reference to the Cryptography Application Block assembly. In Visual Studio, right-click your project node in Solution Explorer and then click Add References. Click Browse to locate the Microsoft.Practices.EnterpriseLibrary.Security.Cryptography.dll assembly. Select the assembly, and then click OK.

  2. Following the same procedure, set a reference to the Enterprise Library Common assembly, Microsoft.Practices.EnterpriseLibrary.Common.dll and to the ObjectBuilder assembly, Microsoft.Practices.EnterpriseLibrary.ObjectBuilder.dll.

  3. (Optional) To use elements from the Cryptography Application Block without fully qualifying the element reference, you can add the following using statement (C#) or Imports statement (Visual Basic) to the top of your source code file.

    using Microsoft.Practices.EnterpriseLibrary.Security.Cryptography;
    
    'Usage
    Imports Microsoft.Practices.EnterpriseLibrary.Security.Cryptography
    

    Note

    For Visual Basic projects, you can also use the References page of the Project Designer to manage references and imported namespaces. To access the References page, select a project node in Solution Explorer, and then click Properties on the Project menu. When the Project Designer appears, click the References tab.

  4. Next, add the application code.

The scenarios in this section demonstrate how to incorporate these steps into an application.

Retired Content

This content is outdated and is no longer being maintained. It is provided as a courtesy for individuals who are still using these technologies. This page may contain URLs that were valid when originally published, but now link to sites or pages that no longer exist.

The latest Enterprise Library information can be found at the Enterprise Library site.