/// <summary>/// Opens the Certificate Store of IE including the Certificates in Token/// </summary>/// <param name="popupScript">The variable passed to store the reason if function returns false</param>/// <returns> True if a certificate is selected and false if no certificate is selected</returns>public Boolean OpenStoreToken(ref string popupScript){x509_2 = null;//Create and Initilaize a variable of x509Store providing the store name and the store locationX509Store st = new X509Store(StoreName.My, StoreLocation.CurrentUser);//Create X509Certificate2Collection X509Certificate2Collection col = new X509Certificate2Collection();//Create X509Certificate2Collection X509Certificate2Collection sel = new X509Certificate2Collection();//Create X509Certificate2Enumerator X509Certificate2Enumerator en;// =new X509Certificate2Enumerator();//Open the Store for readonly purposest.Open(OpenFlags.ReadOnly);//set the col i.e. X509Certificate2Collection to the collection of the certificates stored in the IE and the Tokencol = st.Certificates;//set the sel i.e. X509Certificate2Collection which actuly displays a dialog box for selecting an X.509 certificate from a certificate collection.sel = X509Certificate2UI.SelectFromCollection(col, "Certificates", "Select one to sign", X509SelectionFlag.SingleSelection);if (sel.Count > 0){en = sel.GetEnumerator();en.MoveNext();x509_2 = en.Current;}st.Close();if (x509_2 == null){popupScript = "You didn't select a certificate!!!";return false;}else{return true;}}