In my work environment I have some certificates and I need to select one of them, I would like to know via VN.Net or C # code how do I display a list and choose the digital certificate that I need without having to assign this list of certificates in a combobox
.
Code
Dim ListaCertificados As New List(Of X509Certificate2)()
Private Sub ReloadCerts()
Dim Store As X509Store = New X509Store(StoreName.My, StoreLocation.CurrentUser)
Store.Open(OpenFlags.ReadOnly Or OpenFlags.OpenExistingOnly)
Dim _certs As X509Certificate2Collection = Store.Certificates.Find(X509FindType.FindByTimeValid, DateTime.Now, True).Find(X509FindType.FindByKeyUsage, X509KeyUsageFlags.DigitalSignature, True)
For Each Certificado In _certs
If Certificado.HasPrivateKey Then
ListaCertificados.Add(Certificado)
Certificado.GetNameInfo(X509NameType.SimpleName, False)
End If
Next
End Sub