Cryptography, Certificates, Certificate Providers, Encryption/Decryption algorithms, Hash and more...

Applies To

OS:
VB:
NT, 9x, 2000
5, 6

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:

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)