banr_bklrx.gificon_bw_about.gif (884 bytes)banr_homex_ico.gif (1035 bytes)banr_howbuyx_ico.gif (1114 bytes)banr_descfrx_ico.gif (1119 bytes)banr_hascfrx_ico.gif (1223 bytes)
crypt_tools4swdev.gif (2298 bytes)
Example Project: Encrypted Field in MS Access® '97
using Visual Basic for Applications (VBA)

Download Example Project
(see notes before downloading)

Description: This example project illustrates how to secure sensitive information stored in an Access database using VBA with the DEScipher and HASHcipher ActiveX controls. In this example the clients' Social Security Number (SSN) is encrypted and stored in the database automatically when the user updates the form. If the user supplies the correct password/key the SSN is decrypted temporarily for display and editing in a text box; the SSN is re-encrypted and 

stored when the user moves to another record. If the user attempts to decrypt an SSN using an incorrect password/key the application simply displays a message box to that effect, and makes no changes to the encrypted SSN in the database. In a shared database or workgroup environment this would allow each user to encrypt data "for his eyes only".

The HASHcipher/OCX plays two important roles in this application: 1) to generate a DES key from the user-supplied password, and 2) to "fingerprint" the cleartext SSN. The "fingerprint" allows the user-supplied password/key to be validated securely; i.e. the password does not have to be stored anywhere on the system.
This example also illustrates how to deal with Unicode in the VB/VBA environment. The two byte-per-character format of Unicode requires that the developer understand how it is used in VB/VBA to correctly utilize the HASHcipher and DEScipher controls. See the Tech Support page for more details and sample code.

Table View: The SocSecNumber field contains ciphertext SSNs for each of the contacts, and the SSNHashValue field contains the SHA "fingerprint" for the cleartext SSN.
scrnshot_access_vba4.gif (12886 bytes)


Notes:
1) Due to export restrictions this project DOES NOT contain a copy of the DEScipher/OCX. It will not run unless 
DEScipher/OCX and MS Access '97 have already been installed and registered.

2) This project is not "production quality" code, but intended only to illustrate use of the DEScipher and HASHcipher 
controls in the MS Access/VBA environment. You are free to use this sample project for any legal purpose provided 
you have a valid developer's license for DEScipher/OCX and HASHcipher/OCX. Bokler Software Corp. does not 
warrant, nor do we support this sample project.

3) Password for records in db is "jim@bokler"; create your own password to add additional records!


Copyright © 1995-2000 Bokler Software Corp. All rights reserved. DEScipher, TDEScipher and HASHcipher are trademarks of Bokler Software Corp. The "animated_cipher.gif" is copyrighted by Bokler Software Corp. Microsoft, Windows, Visual Basic, Visual C++ and ActiveX are trademarks of Microsoft Corp.