By Brian Yule (byule at PembrokeTechnology.com)
Download the project (150 kb)
Cryptography has long been difficult to do with Visual Basic 6. This code changes all that.
Provided below is a beautifully built and well thought out object implementation of various bits and
pieces of cryptography puzzle.
The provides following features:
- Shows how to encrypt/decrypt data, also known as two-way decryption
- Shows how to sign data, known as one way decryption
- Supplies the list of Providers on the local machine
- Provides the list of Certificates on the local machine
- Provides detailed information on each Certificate
- Handles 3des, des, RC2, RC4, SHA1, MD2, MD4, MD5
The objects also provide helper methods intended to ease the development of windows application,
like ability to load a list of certificates into a given combo box. Provided below is a quick example
that display how easy it is to retrieve a list of Providers, Certificates, Containers and Algorithms.
All this is also in the download. Right now, this code is being used to create Software License Keys.
The code comes as code group containing 2 projects. The 1st one is the Cryptography
implementation itself. It is implemented as an ActiveX DLL. The second project is
the test project that drives the Cryptography implementation and shows off various tricks uses for cryptography. To get
started, simply double-click the g.vbg file.
| Add the following to a Form |
Private Sub btnLoadStuff_Click()
'load list of providers into a combo box
providers.LoadComboBox Combo1.hWnd
'load a list of containers into a combo box
providers.Item(Combo1.ListIndex).apiLoadContainers Combo2.hWnd
'load a list of available algorithms into a combo box
providers.Item(Combo1.ListIndex).apiLoadAlgorithms Combo3.hWnd
'verify that the provided password is correct
hash.Verify byteSignature, signatureKey
End Sub
Download the project (150 kb)