X509StoreExtensions

Namespace: WvdS.System.Security.Cryptography.X509Certificates

Extensions for X509Store with post-quantum key persistence. Enables saving and restoring PQ keys in the Windows Certificate Store.

Methods

Method Description
Add(certificate, mode) Adds certificate and persists PQ keys
AddRange(collection, mode) Adds multiple certificates
Remove(certificate, deletePqKeys) Removes certificate and optionally PQ keys
Find(findType, findValue, validOnly, restorePqKeys) Searches certificates and restores PQ keys
GetCertificatesWithPqKeys() All certificates with restored PQ keys

Static Methods

Method Description
PersistPqKeys(certificate) Persists PQ keys manually
RestorePqKeys(certificate) Restores PQ keys manually
DeletePqKeys(certificate) Deletes persisted PQ keys
HasPersistedPqKeys(certificate) Checks if PQ keys exist

Example

using var store = new X509Store(StoreName.My, StoreLocation.CurrentUser);
store.Open(OpenFlags.ReadWrite);
 
// Add certificate with PQ keys
var hybridCert = CreateHybridCertificate();
store.Add(hybridCert, CryptoMode.Hybrid);
 
// Search later and restore PQ keys
var certs = store.Find(
    X509FindType.FindBySubjectName,
    "MyCertificate",
    validOnly: true,
    restorePqKeys: true);

Storage Location

Operating System Path
Windows %LOCALAPPDATA%\WvdS.Crypto\PqKeys\
Linux ~/.local/share/WvdS.Crypto/PqKeys/
macOS ~/Library/Application Support/WvdS.Crypto/PqKeys/

Security Notes

  • PQ keys are only accessible to the current user (DPAPI/AES encrypted)
  • Create backup before system migration
  • Run CleanupOrphanedKeys() regularly

See Also


Wolfgang van der Stille @ EMSR DATA d.o.o. - Post-Quantum Cryptography Professional

Zuletzt geändert: on 2026/01/29 at 11:20 PM