Digital Trust Interoperability Lab is built on five principles:
- Vendor Neutrality — no proprietary code, no vendor-specific hard-coding
- Layer Isolation — each cryptographic layer is tested independently
- Local-Only — zero network transmission of any cryptographic material
- Standards Compliance — all operations use published open standards
- Actionable Output — every finding includes root cause + remediation
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
- MFC Dialog with 7 tabs
- Multi-threaded operation (all heavy work in background threads)
- Real-time console log via
PostMessage - Tab-based navigation:
- Dashboard (overall status)
- System Info
- Crypto Providers (CSP + KSP)
- Certificates
- Console (log)
- PKCS#11 Test
- Signature Test
File: Core/DiagnosticEngine.cpp
Orchestrates system, provider, and certificate diagnostics.
Coordinates:
- SystemDiagnostic
- CryptoAPIAdapter
- CNGAdapter
- CertificateManager
File: Signature/SignatureEngine.cpp
Multi-provider signature generation:
- CryptoAPI path (CSP)
- CNG path (KSP)
- HP_HASHVAL injection for legacy providers
File: Signature/SignatureVerifier.cpp
Cryptographic verification with certificate chain building.
File: PKCS11/PKCS11Loader.cpp
Dynamic PKCS#11 DLL loading and testing:
- No compile-time dependency on any PKCS#11 library
- Direct
GetProcAddress(no CK_FUNCTION_LIST struct) - 9 standard test cases
- Login-enabled signing with PIN
- Automatic DLL reload for vendor state recovery
File: Providers/CryptoAPIAdapter.cpp
- Enumerates legacy CSPs via
CryptEnumProviders - Extracts capabilities (Sign, Encrypt, Hardware)
- Discovers supported algorithms
File: Providers/CNGAdapter.cpp
- Enumerates CNG KSPs via
NCryptEnumProviders - Tests provider availability
- Identifies hardware/software providers
File: Certificate/CertificateManager.cpp
- Scans 8 stores × 2 locations = 16 stores
- Analyzes each certificate:
- Basic X.509 fields
- Chain of trust
- Private-key binding
- Provider association
- Token-backed vs software-backed
- CryptoAPI (CAPI) — legacy crypto (Windows 2000+)
- CNG (Cryptography Next Generation) — modern crypto (Vista+)
- Certificate Store APIs — X.509 handling
- NCrypt — CNG key operations
- Legacy CSPs (installed by vendor middleware)
- CNG KSPs (installed by vendor middleware)
- PKCS#11 DLLs (loaded dynamically)
- Hardware tokens (smart cards, USB tokens, HSMs)
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.
- All heavy operations run in background threads
- UI updates via
PostMessage(neverSendMessagefrom workers) - No shared mutable state between threads without synchronization
- Thread lifecycle:
- Created with
CreateThread - Handle stored in view member
- Waited on with
WaitForSingleObjectin destructor - Closed with
CloseHandleafter completion
- Created with
SecureZeroMemoryfor all PIN buffers- No
strcpy/sprintf— only_sntprintf_s,_tcscpy_s - Explicit
LocalFreefor allLocalAllocallocations - RAII where possible (via MFC classes like
CString,CFile)
- Every Win32 API call is checked for error
- Errors logged with descriptive messages
- User-facing errors show:
- Human-readable description
- Error code (for support)
- Suggested remediation
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)- User selection (PKCS#11 DLLs)
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) |
- Single portable EXE
- No installer required
- No registry entries
- No dependency DLLs (statically linked CRT)
- Can be run from USB drive
- Uninstall = delete file
The architecture supports future extensions:
- Additional adapters — add new provider types
- Additional test cases — extend PKCS#11 test suite
- Additional report formats — JSON, XML, PDF
- Additional standards — TSP, OCSP live testing
- Cross-machine mode — export/import diagnostics
+----------------------------------------------------------+
| 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