public void AnchorEnsure(string[] args) { string owner = args.GetRequiredValue(0); CertificateFileInfo certFileInfo = CertificateFileInfo.Create(1, args); PushCerts(owner, certFileInfo.LoadCerts(), true, certFileInfo.Status); }
public void CertificateAdd(string[] args) { CertificateFileInfo certFileInfo = CertificateFileInfo.Create(0, args); MemoryX509Store certStore = certFileInfo.LoadCerts(); PushCerts(certStore, false, certFileInfo.Status); }
public void CertificateAdd(string[] args) { var certFileInfo = CertificateFileInfo.Create(0, args); var certStore = certFileInfo.LoadCerts(); using (var session = m_slot.OpenSession(true)) { foreach (var x509Cert in certStore.GetAllCertificates()) { // Parse certificate var x509CertificateParser = new X509CertificateParser(); var x509Certificate = x509CertificateParser.ReadCertificate(x509Cert.RawData); // Get public key from certificate var pubKeyParams = x509Certificate.GetPublicKey(); //AsymmetricKeyParameter if (!(pubKeyParams is RsaKeyParameters)) { throw new NotSupportedException("Unsupported keys. Currently supporting RSA keys only."); } var rsaPubKeyParams = (RsaKeyParameters)pubKeyParams; ValidatePrivateKeyCorrelatioin(rsaPubKeyParams, session); PushPublicCert(x509Cert, false, certFileInfo.Status); } } }
public void CertificateExportKey(string[] args) { CertificateFileInfo certFileInfo = CertificateFileInfo.Create(0, args); MemoryX509Store certStore = certFileInfo.LoadCerts(); ShowKey(certStore); }
public void CertificateAddMachine(string[] args) { using (SystemX509Store store = OpenStore(args.GetRequiredValue(0))) { CertificateFileInfo certFileInfo = CertificateFileInfo.Create(1, args); store.ImportKeyFile(certFileInfo.FilePath, certFileInfo.Password, MachineKeyFlags); } }
public void AnchorAddMachine(string[] args) { CertificateFileInfo certFileInfo = CertificateFileInfo.Create(0, args); using (SystemX509Store store = SystemX509Store.OpenAnchorEdit()) { store.ImportKeyFile(certFileInfo.FilePath, certFileInfo.Password, X509KeyStorageFlags.MachineKeySet | X509KeyStorageFlags.Exportable | X509KeyStorageFlags.PersistKeySet); } }
public void CertificateEnsure(string[] args) { CertificateFileInfo certFileInfo = CertificateFileInfo.Create(0, args); MemoryX509Store certStore = certFileInfo.LoadCerts(); // // This checks for duplicates...(using thumbprints) // PushCerts(certStore, true, certFileInfo.Status); }
public void AnchorAddEx(string[] args) { string owner = args.GetRequiredValue(0); bool forIncoming = args.GetRequiredValue <bool>(1); bool forOutgoing = args.GetRequiredValue <bool>(2); bool checkDupes = args.GetRequiredValue <bool>(3); CertificateFileInfo certFileInfo = CertificateFileInfo.Create(4, args); PushCerts(owner, certFileInfo.LoadCerts(), false, certFileInfo.Status, forIncoming, forOutgoing); }
public void CertificateSearchByFile(string[] args) { CertificateFileInfo certFileInfo = CertificateFileInfo.Create(0, args); MemoryX509Store certs = certFileInfo.LoadCerts(); WriteLine(string.Empty); this.Search( x => (certs.FirstOrDefault(y => this.Match(x, y)) != null) ); }
public void AnchorSearchByFile(string[] args) { string owner = args.GetRequiredValue(0); CertificateFileInfo certFileInfo = CertificateFileInfo.Create(1, args); MemoryX509Store certs = certFileInfo.LoadCerts(); WriteLine(string.Empty); this.Search( owner, x => (certs.FirstOrDefault(y => this.CertCommands.Match(x, y)) != null) ); }
public void CertificateEnsureMachine(string[] args) { using (SystemX509Store store = OpenStore(args.GetRequiredValue(0))) { CertificateFileInfo certFileInfo = CertificateFileInfo.Create(1, args); MemoryX509Store certs = certFileInfo.LoadCerts(MachineKeyFlags); foreach (X509Certificate2 cert in certs) { string comment = "EXISTS"; if (!store.Contains(cert)) { store.Add(cert); comment = "ADDED"; } WriteLine("{0}: {1}, Thumbprint:{2}", comment, cert.Subject, cert.Thumbprint); } } }