Classic Visual Basic (VB6/VBA) code is shown shaded as follows:
Dim strData As String Dim nRet As Long strData = "Hello world" Debug.Print strData ' ... etc
Code in C/C++ is shown as:
char *str = "Hello world";
printf("%s\n", str);
Code in VB.NET is shown as:
Dim nDataLen As Integer Dim abData() As Byte If strData.Length = 0 Then Exit Function abData = System.Text.Encoding.Default.GetBytes(strData) nDataLen = abData.Length
Code in C# is shown as:
// Encrypt in CBC mode using hex strings
keyhex = "737C791F25EAD0E04629254352F7DC6291E5CB26917ADA32";
ivhex = "B36B6BFB6231084E";
plain = "5468697320736F6D652073616D706520636F6E74656E742E0808080808080808";
cipher = "d76fd1178fbd02f84231f5c1d2a2f74a4159482964f675248254223daf9af8e4";
s = Tdea.Encrypt(plain, keyhex, Mode.CBC, ivhex);
Console.WriteLine("CT={0}",s);
Console.WriteLine("OK={0}",cipher);
Debug.Assert(String.Compare(s, cipher, true)==0, "Tdea.Encrypt{Hex,CBC} failed");
Output from code samples is shown as:
Result=OK
All functions called directly in the CryptoSys PKI toolkit begin with 3 or 4 capital letters followed by an underscore "_", e.g.
nRet = RSA_ReadPublicKey(rsaReadPublicKey, nKeyLen, strKeyFile, 0)
For VB6/VBA users, there are some wrapper functions provided in basCrPKI
which avoid the complications of having to pre-dimension strings, etc. These
begin with lowercase letters and no underscore. They are shown in our examples as follows:
strPublicKey = rsaReadPublicKey(strKeyFile)