0
I have this function which searches the certificate by serial:
public static X509Certificate2 EscolherCertificado()
{
var store = new X509Store("MY", StoreLocation.CurrentUser);
X509Certificate2 x509 = null;
var Key = new RSACryptoServiceProvider();
store.Open(OpenFlags.ReadOnly | OpenFlags.OpenExistingOnly);
X509Certificate2Collection collection = store.Certificates;
X509Certificate2Collection fcollection = collection.Find(X509FindType.FindBySerialNumber, "serialcertificadoaqui", false);
if (fcollection.Count == 1)
{
return fcollection[0];
}
else { return null; }
}
But at first I won’t know the serial, how can I fetch the certificate serial through a function ? Without the user needing to type, it is possible ?