CryptoSys PKI examples VB6 to VB.NET
CryptoSys PKI Examples VB6 to VB.NET
This is a conversion of most of the VB6 examples in the CryptoSys PKI manual to VB.NET (a.k.a. Visual Basic 2005/8/x).
The translations are pretty literal, so we've left in many lines that could be left out or re-worded more appropriately.
This is deliberate so you can better see how the translation is done. Lines in VB.NET deliberately commented out begin with
two apostrophes ('').
Note that these examples are meant to show the basic operation of each primitive cryptographic function,
using known test vectors wherever possible.
They are not meant to show how to use the primitive functions as part of a proper cryptosystem.
If you don't understand what this means, you probably shouldn't be using this library.
Download the original source code plus the complete HTML file (103 kB).
This includes all the required test files, the original VB6 tests, the new VB.NET examples, and a conversion of the VB.NET code to C#.
The .NET code is for a command-line "Console Application" project.
This document last updated 30 June 2010
Contents
Important points when converting VB6 code to VB.NET
- Cipher
-
CIPHER_Bytes |
CIPHER_File |
CIPHER_Hex |
CIPHER_KeyUnwrap |
CIPHER_KeyWrap
- CMS
-
CMS_GetSigDataDigest |
CMS_GetSigDataDigest_2 |
CMS_MakeDetachedSig |
CMS_MakeEnvData |
CMS_MakeEnvDataFromString |
CMS_MakeEnvData_2 |
CMS_MakeEnvData_3 |
CMS_MakeSigData |
CMS_MakeSigDataFromSigValue |
CMS_MakeSigData_2 |
CMS_ReadEnvData |
CMS_ReadEnvDataToString |
CMS_ReadSigData |
CMS_ReadSigDataToString |
CMS_VerifySigData
- CNV
-
CNV_CheckUTF8
- Hash
-
HASH_Bytes |
HASH_File |
HASH_HexFromBytes |
HASH_HexFromFile |
HASH_HexFromHex |
HASH_HexFromString
- HMAC
-
HMAC_Bytes |
HMAC_HexFromBytes |
HMAC_HexFromHex
- OCSP
-
OCSP_MakeRequest |
OCSP_ReadResponse
- PEM
-
PEM_FileFromBinFile |
PEM_FileToBinFile
- PFX
-
PFX_MakeFile |
PFX_MakeFile_2
- General
-
PKI_CompileTime |
PKI_ErrorLookup |
PKI_LicenceType |
PKI_ModuleName |
PKI_PowerUpTests |
PKI_Version |
PWD_PromptEx
- RNG
-
RNG_Bytes |
RNG_BytesWithPrompt |
RNG_Initialize |
RNG_Number |
RNG_Test
- RSA
-
RSA_DecodeMsg |
RSA_EncodeMsg |
RSA_FromXMLString |
RSA_FromXMLString_2 |
RSA_GetPublicKeyFromCert |
RSA_KeyMatch |
RSA_MakeKeys |
RSA_RawPrivate |
RSA_ReadPrivateKeyInfo |
RSA_SaveEncPrivateKey |
RSA_SavePrivateKeyInfo |
RSA_ToXMLString
- Triple DES
-
TDEA_B64Mode |
TDEA_BytesMode |
TDEA_File |
TDEA_HexMode
- Wipe
-
WIPE_File
- X509
-
X509_CertExpiresOn |
X509_CertIsValidNow |
X509_CertRequest |
X509_CertRequest_2 |
X509_CertSerialNumber |
X509_CertSubjectName |
X509_CertThumb |
X509_CheckCertInCRL |
X509_GetCertFromP7Chain |
X509_HashIssuerAndSN |
X509_KeyUsageFlags |
X509_MakeCRL |
X509_MakeCert |
X509_MakeCertSelf |
X509_MakeCertSelf_2 |
X509_TextDump |
X509_ValidatePath |
X509_VerifyCert