Cryptlib coding samples written in Delphi®
There are 10 little Delphi programs showing the functions of cryptlib and using
DelphiCryptlib.pas. Nine programs are console applications, single source files with
extention ".dpr", so they show the possibilities of cryptlib without the
Windows and Delphi overhead. MD5 is a Windows Forms application.
To compile and run the source, you need:
- Any 32-bit Windows version (XP, Vista, Windows 7, Windows 8, Windows 10)
- Cryptlib
V3.4.3
- DelphiCryptlib.pas and Cryptlib.pas
- Borland's/Embarcadero's Delphi (Delphi2009 / Delphi 10)
Some details about the samples:
- CertTest
create public/private key pair and a selfsigned CA certificate for the key.
- HashTest
compute hash on a given file content.
- ConvCryptTest
encrypt a file using conventional encryption, algorithm AES (Rijndael)
decrypt the encoded file again and compare with the input file.
- PKCCryptTest
encrypt and decrypt a file using the public/private key pair from CertTest
- PKCSignTest
sign a file with the private key from CertTest and verify the signature using
the certificate created with CertTest.
- StringIO
compress and encode a string with function StringIO, then decode and uncompress
it again. Compare the result with the input. The string used for encoding
is a string containing the program source.
- CreateDB
create 2 public/private key pairs and certificates signed with the CA certificate
from CertTest. Store the certificates in an ODBC database (alias PublicKeys).
- CryptAllTest
using the keys and certificates created by CreateDB do:
sign, compress and encode a file,
then decode, uncompress it again and check the signature.
Compare the result with the input file.
- CryptAllStringTest
using the keys and certificates created by CreateDB do:
Sign, compress and encode a string with function StringIO, then decode,
uncompress it again and check the signature. Compare the result with the
input. The string used for encoding is a string containing the program source.
This example is almost the same as CryptAllTest, but uses strings instead of streams.
- MD5
utility with Windows GUI for hashcode creation and verifying. The Program works
with the unix style files MD5SUMS containing MD5 hash and filenames.
As you can see from the comments above, you must call CertTest first and call CreateDB
before using CryptAllTest.
And you know, if you download the source, you do it on your own risk. I can't give
you any support and any warranties are explicitly disclaimed.
Cryptlib V3.4.3 |
Files |
Comment |
|
HashTest.dpr
ConvCryptTest.dpr
CertTest.dpr
CreateDB.dpr
PKCCryptTest.dpr
PKCSignTest.dpr
CryptAllTest.dpr
StringIO.dpr
CryptAllStringTest.dpr
MD5.dpr
MD5Form.pas
MD5Form.dfm
|
Sample sources that create simple console applications
(without graphic GUI) and one Windows Application (MD5) to show the methods
and properties declared in DelphiCryptlib.pas
(*.dpr = Delphi project files)
|