Gestione Trust Store personalizzato per infrastrutture PKI compatibili con PQ.
| Classe | Descrizione |
|---|---|
PqTrustStore | Trust Store completo con supporto PQ |
TrustStoreExtensions | Extension Methods per X509Certificate2Collection |
TrustEntry | Metadati per voci del Trust Store |
using WvdS.System.Security.Cryptography.X509Certificates; // Creare Trust Store using var trustStore = new PqTrustStore(); // Aggiungere Root CA var rootCa = new X509Certificate2("root-ca.cer"); trustStore.AddTrustAnchor(rootCa, alias: "Company Root CA"); // Aggiungere Intermediate CA var intermediateCa = new X509Certificate2("intermediate-ca.cer"); trustStore.AddIntermediate(intermediateCa, alias: "Issuing CA");
// Caricare Trust Store using var trustStore = PqTrustStore.LoadFromPem("company-trust-store.pem"); // Validare certificato var userCert = new X509Certificate2("user.cer"); using var chain = new X509Chain(); bool isValid = chain.Build(userCert, trustStore, CryptoMode.Hybrid);
// Salvare/caricare bundle PEM trustStore.SaveToPem("trust-store.pem"); var loadedStore = PqTrustStore.LoadFromPem("trust-store.pem"); // PKCS#7 (DER) trustStore.SaveToPkcs7("trust-store.p7b"); var p7Store = PqTrustStore.LoadFromPkcs7("trust-store.p7b");
using var trustStore = new PqTrustStore(); // Importare Root CA di Windows trustStore.ImportFromSystemRootStore(); // Esportare come PEM per sistemi air-gapped trustStore.SaveToPem("system-trust-store.pem");
| Valore | Descrizione |
|---|---|
TrustAnchor | Ancora di fiducia (Root CA) |
IntermediateCA | Autorita di certificazione intermedia |
CrossCertifiedCA | CA con certificazione incrociata |
EndEntity | End-Entity (non CA) |
// Solo Trust Anchor var roots = trustStore.TrustAnchors; // Solo Intermediate CA var intermediates = trustStore.IntermediateCAs; // Ricerca per Subject/Thumbprint var found = trustStore.FindBySubjectName("Company"); var entry = trustStore.FindByThumbprint("A1B2C3...");
Wolfgang van der Stille @ EMSR DATA d.o.o. - Post-Quantum Cryptography Professional