Digital Trust Interoperability Lab is built on five principles:
The application is a Windows MFC dialog-based desktop tool that performs comprehensive diagnostics across multiple layers of the PKI stack.
Files: DiagnosticView.cpp, DigitalTrustLabDlg.cpp
PostMessageFile: Core/DiagnosticEngine.cpp
Orchestrates system, provider, and certificate diagnostics.
Coordinates:
File: Signature/SignatureEngine.cpp
Multi-provider signature generation:
File: Signature/SignatureVerifier.cpp
Cryptographic verification with certificate chain building.
File: PKCS11/PKCS11Loader.cpp
Dynamic PKCS#11 DLL loading and testing:
GetProcAddress (no CK_FUNCTION_LIST struct)File: Providers/CryptoAPIAdapter.cpp
CryptEnumProvidersFile: Providers/CNGAdapter.cpp
NCryptEnumProvidersFile: Certificate/CertificateManager.cpp
User clicks [Run All Diagnostics]
|
v
DiagnosticEngine.RunAll()
|
+--> SystemInfo.Collect()
+--> CryptoAPIAdapter.EnumerateProviders()
+--> CNGAdapter.EnumerateProviders()
+--> CertificateManager.EnumerateStores()
|
v
Results aggregated in DiagnosticResultSet
|
v
UI updated via PostMessage(WM_DIAG_COMPLETE)
|
v
Dashboard, System Info, Providers, Certificates tabs populated
User clicks [Sign]
|
v
SignatureEngine.SignFile()
|
+--> Find certificate in store
+--> CertGetCertificateContextProperty (get provider info)
+--> CryptAcquireCertificatePrivateKey
+--> CryptCreateHash + CryptHashData
| OR (for legacy CSP)
| Compute hash externally, then HP_HASHVAL inject
+--> CryptSignHash (with PIN prompt from provider)
+--> Reverse bytes (little-endian to big-endian)
|
v
Signature stored in SignatureResult
|
v
UI updated: Signature History + Result panel
User clicks [Sign via PKCS#11]
|
v
Custom PIN dialog (in-memory template)
|
v
Background thread starts:
|
+--> PKCS11Loader.EnsureInitialized()
| (reload DLL if needed for vendor state recovery)
+--> C_Login with PIN
| (PIN SecureZeroMemory'd after use)
+--> FindFirstSigningKey()
+--> Read file into memory
+--> Compute SHA-256 hash externally
+--> Build ASN.1 DigestInfo + Hash
+--> C_SignInit + C_Sign (CKM_RSA_PKCS)
+--> C_Logout
|
v
Signature stored in SignatureResult
|
v
UI updated
Both signatures should be byte-identical for RSA-PKCS#1 v1.5 signing with the same key, file, and hash algorithm. This is proven empirically in the tool’s output.
PostMessage (never SendMessage from workers)CreateThreadWaitForSingleObject in destructorCloseHandle after completionSecureZeroMemory for all PIN buffersstrcpy / sprintf — only _sntprintf_s, _tcscpy_sLocalFree for all LocalAlloc allocationsCString, CFile)Uses direct GetProcAddress instead of CK_FUNCTION_LIST
struct to avoid layout compatibility issues with vendor DLLs.
This approach was chosen after crash reports from certain vendor DLLs that use non-standard struct layouts.
Never hard-codes vendor names. All provider identification is runtime-discovered from:
CryptEnumProviders (CSPs)NCryptEnumProviders (KSPs)Uses only standard Windows certificate store APIs. No registry hacks, no undocumented APIs.
| Setting | Value |
|---|---|
| Compiler | Visual C++ 2008 (VS 2008 SP1) |
| Framework | MFC (statically linked) |
| Target | Win32 (x86) |
| CRT | Multi-threaded static (/MT for Release) |
| Character Set | Unicode (UTF-16 internal) |
| Optimization | /O2 for Release |
| Debug info | /Zi (both Debug and Release) |
The architecture supports future extensions:
+----------------------------------------------------------+
| USER INTERFACE (MFC) |
| Dashboard | System | Providers | Certs | PKCS11 | Sign |
+----------------------+-----------------------------------+
|
+-----------------+-------------------+
| | |
v v v
+---------+ +-------------+ +-----------+
|Diagnos. | | Signature | | PKCS#11 |
| Engine | | Engine | | Loader |
+----+----+ +------+------+ +-----+-----+
| | |
v v v
+----------------------------+ +--------------+
| Windows CryptoAPI + CNG | | Vendor DLLs |
| (Vendor-Neutral Layer) | +--------------+
+----+---------------+-------+ |
| | |
v v v
+---------+ +---------+ +---------+
| Legacy | | CNG | | PKCS#11 |
| CSPs | | KSPs | | Vendor |
+----+----+ +----+----+ +----+----+
| | |
+---------------+--------------------+
|
v
+--------------------------+
| HARDWARE TOKENS |
| Smart Cards, USB, HSM |
+--------------------------+
Digital Trust Interoperability Lab — Vendor-Neutral by Design