"Encrypt and Decrypt Data in Yukon" by Roger Jennings
Visual Studio Magazine, August 2005

README FILE FOR THE ENCRYPTION.SLN SAMPLE PROJECT

Note: This project requires VS 2005 or Visual Basic Express Beta 2 or later and SQL Server 2005 or SQL Server Express April CTP or later.

1. Encyrption.sln contains two instances of the CreditCards.mdf sample database file:

If you're using SQL Server 2005 Developer Edition or higher, permanantnly attach CreditCards.mdf and CreditCards.ldf from the \Encryption folder to your instance with SQL Management Studio. This instance is assumed to be 'localhost'.

If you're using SQL Express, change Dim blnIsSQLExpress As Boolean = False to Dim blnIsSQLExpress As Boolean = True in Public Class Encryption. This should attach \Encryption\bin\Debug\CreditCards.mdf to your SQL Express instance when you build and run the project. (CreditCards.mdf is included in the project; you might need to delete the existing CreditCards_LOG.LDF file). This instance is .\SQLEXPRESS.

You can attach both copies of CreditCards.mdf to instances of SQL Server 2005 and SQL Express running on the same machine.

2. Click Create Users, Certificates, and Keys to generate required encryption-related objects for the specified instance.

Note that creating user-specific certificates and keys requires enabling mixed-mode SQL Server 2005 authentication.

3. Select an encryption/decryption method and maximum number of rows, then click the Encrypt button.

4. After encrypting multiple credit card numbers, click the Decrypt button to decrypt and display plaintext values.

Alternatively, click a DataGridView row selector button to decrypt a specific credit card number.

5. Encryption by IssuerAdmins (VisaAdmin, MastAdmin, AmexAdmin, and DiscAdmin) requires marking the By User check box, marking the Symmetric Keys Only check box, and clicking the Encrypt All Card Numbers by Issuer/User button.

6. To Decrypt with the sa account card numbers encrypted by Issuer Admins, perform step 5, mark the Decrypt All Cards as SA check box, and click the Decrypt All Cards as sysadmin User button.

If you want to remove all encryption-related objects from the current instance, click the Remove Encryption-Related Objects button. 


