I need to auto select the digital certificate when I made the login in some sites.
FireFox have the "remeber me" features to save which certificade will be autoselect when I in the future login again in the wbesite. 
After a select the certificate and close the window, firefox generate the file ClientAuthRememberList.txt in the profile path. The content of the text file is this:
notacarioca.rio.gov.br,50:EC:94:C0:75:30:A4:CC:38:36:7C:CB:76:B3:DE:7C:4A:4C:F1:45:FF:0E:7D:94:D2:EC:C0:2E:8C:67:40:4F,^partitionKey=%28https%2Crio.gov.br%29 2 18998 AAAAAAAAAAAAAAAIAAAAkjhDHSKJDkjmaskashdkaKHSKJdÇKLDasjKdksajÇLKSJdhçLAKSKDHSKJdkasndakKDJhskjaka
The Base64 in the end of the file is the certificate identification, so if I generate that base64 like firefox does I can choose the certificate to login.
Here is the source code of Firefox, where have the method in c++ to generate base64 above, but I need todo this same method in c#. In the link above have a comment of how to buil the base64, and is this:
The format of the key is the base64 encoding of the following:
4 bytes: {0, 0, 0, 0} (this was intended to be the module ID, but it was never implemented)
4 bytes: {0, 0, 0, 0} (this was intended to be the slot ID, but it was never implemented)
4 bytes: serial number length in big-endian order
4 bytes: DER-encoded issuer distinguished name length in big-endian order
n bytes: bytes of serial number
m bytes: DER-encoded issuer distinguished name
The code below genarate the firth part of the base64 string:
string GenerateBase64FromCertificate(string certificatePath, string password)
{
var pfxData = File.ReadAllBytes(certificatePath);
var cert = new X509Certificate(pfxData, password, X509KeyStorageFlags.MachineKeySet | X509KeyStorageFlags.Exportable);
StringBuilder dbKey = new StringBuilder();
char[] leadingZeroes = new[] { (char)0, (char)0, (char)0, (char)0, (char)0, (char)0, (char)0, (char)0, (char)0, (char)0, (char)0 };
dbKey.Append(leadingZeroes);
dbKey.Append('\b');
dbKey.Append(new[] { (char)0, (char)0, (char)0 });
byte[] toEncodeAsBytes = System.Text.ASCIIEncoding.ASCII.GetBytes(dbKey.ToString());
string returnValue = System.Convert.ToBase64String(toEncodeAsBytes);
return returnValue;
}
I will make the automatization of this with FlaUI, but is just for delivery the software in the deadline time. Thank´s for read this and I'll be thankful for some help!