public void UpdateStoreInfo(string storename) { UIErrorHelper.CheckedExec(delegate() { if (storename != null) { string storePass = ""; using (var session = new VecsStoreSession(ServerDTO.VecsClient, storename, storePass)) { // update store info if (StoresInfo.ContainsKey(storename)) { StoresInfo [storename] = new CertBagItem() { PrivateKeys = session.GetPrivateKeys().Concat(session.GetEncryptedPrivateKeys()).ToList(), SecretKeys = session.GetSecretKeys().ToList(), Certs = session.GetCertificates().ToList() }; CalculateKeyInfo(); } else { StoresInfo.Add(storename, new CertBagItem() { PrivateKeys = session.GetPrivateKeys().Concat(session.GetEncryptedPrivateKeys()).ToList(), SecretKeys = session.GetSecretKeys().ToList(), Certs = session.GetCertificates().ToList() }); NoStores++; } } } }); }
public override void Refresh() { ResultNodes.Clear(); var entriesNode = this.ScopeNode as VecsStoreEntriesNode; var dto = entriesNode.ServerDTO; var storeName = entriesNode.StoreName; var storePass = ""; MMCActionHelper.CheckedExec(delegate() { using (var session = new VecsStoreSession(dto.VecsClient, storeName, storePass)) { var lst = new List <Vecs.CertDTO>(); lst.AddRange(session.GetPrivateKeys()); lst.AddRange(session.GetEncryptedPrivateKeys()); foreach (var certDTO in lst) { var resultNode = new ResultNode { DisplayName = certDTO.Alias }; resultNode.ImageIndex = (int)VMCertStoreImageIndex.PrivateEntities; if (certDTO.Cert != null) { resultNode.SubItemDisplayNames.Add(certDTO.Cert.Subject); resultNode.SubItemDisplayNames.Add(certDTO.Cert.Issuer); resultNode.SubItemDisplayNames.Add(certDTO.Cert.NotBefore.ToShortDateString()); resultNode.SubItemDisplayNames.Add(certDTO.Cert.NotAfter.ToShortDateString()); resultNode.SubItemDisplayNames.Add(certDTO.Cert.GetKeyUsage()); resultNode.Tag = certDTO; } this.ResultNodes.Add(resultNode); } } }); this.Sort(0); this.DescriptionBarText = this.ResultNodes.Count.ToString(); }
public async void FillServerInfo() { try { var stores = ServerDTO.VecsClient.GetStores(); IsDetailsLoaded = true; StoresInfo.Clear(); foreach (var store in stores) { var storePass = ""; using (var session = new VecsStoreSession(ServerDTO.VecsClient, store, storePass)) { //store add StoresInfo.Add(store, new CertBagItem() { PrivateKeys = session.GetPrivateKeys().Concat(session.GetEncryptedPrivateKeys()).ToList(), SecretKeys = session.GetSecretKeys().ToList(), Certs = session.GetCertificates().ToList() }); } } CalculateKeyInfo(); } catch (Exception e) { // do nothing in async task. } }