Hello Will,<div><br></div><div>Mono was written for Linux where no such system/user store existed. As such mono implemented it&#39;s own certificate and key storage. The same code is executed when you run under Windows so you&#39;ll need to import what you need into them (using mono tools).</div>
<div><br></div><div>Sebastien<br><br><div class="gmail_quote">On Thu, Dec 22, 2011 at 12:54 PM, will.omalley <span dir="ltr">&lt;<a href="mailto:omalley.william@gmail.com">omalley.william@gmail.com</a>&gt;</span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">I have posted this in Mono-General as well:<br>
I&#39;m new here so I wanted to make sure I reached people.<br>
<br>
<br>
The following code does not work correctly. When running MonoDevelop on<br>
Windows XP using the Mono-2.10.2 libraries.<br>
I have several certificates in AuthRoot, CA, My and TrustedPublisher.<br>
However, no results get printed to the screen for any store and the<br>
certificate count is always 0<br>
<br>
Full Console Program -- Mono-2.10.2<br>
OS: Microsoft Windows XP 32<br>
SP: 3<br>
<br>
&lt;CODE&gt;<br>
<br>
using System;<br>
using System.Security;<br>
using System.Security.Cryptography;<br>
using System.Security.Cryptography.X509Certificates;<br>
<br>
namespace MonoConsoleProject<br>
{<br>
        class MainClass<br>
        {<br>
        private static X509Store certStore;<br>
<br>
        public static void Main (string[] args)<br>
        {<br>
            certStore = new X509Store(StoreName.AddressBook,<br>
StoreLocation.CurrentUser);<br>
            FindCertInStore(certStore, &quot;StoreName.AddressBook,<br>
StoreLocation.CurrentUser&quot;);<br>
            //<br>
            certStore = new X509Store(StoreName.AuthRoot,<br>
StoreLocation.CurrentUser);<br>
            FindCertInStore(certStore, &quot;StoreName.AuthRoot,<br>
StoreLocation.CurrentUser&quot;);<br>
            //<br>
            certStore = new X509Store(StoreName.CertificateAuthority,<br>
StoreLocation.CurrentUser);<br>
            FindCertInStore(certStore, &quot;StoreName.CertificateAuthority,<br>
StoreLocation.CurrentUser&quot;);<br>
            //<br>
            certStore = new X509Store(StoreName.Disallowed,<br>
StoreLocation.CurrentUser);<br>
            FindCertInStore(certStore, &quot;StoreName.Disallowed,<br>
StoreLocation.CurrentUser&quot;);<br>
            //<br>
            certStore = new X509Store(StoreName.My,<br>
StoreLocation.CurrentUser);<br>
            FindCertInStore(certStore, &quot;StoreName.My,<br>
StoreLocation.CurrentUser&quot;);<br>
            //<br>
            certStore = new X509Store(StoreName.Root,<br>
StoreLocation.CurrentUser);<br>
            FindCertInStore(certStore, &quot;StoreName.Root,<br>
StoreLocation.CurrentUser&quot;);<br>
            //<br>
            certStore = new X509Store(StoreName.TrustedPeople,<br>
StoreLocation.CurrentUser);<br>
            FindCertInStore(certStore, &quot;StoreName.TrustedPeople,<br>
StoreLocation.CurrentUser&quot;);<br>
            //<br>
            certStore = new X509Store(StoreName.TrustedPublisher,<br>
StoreLocation.CurrentUser);<br>
            FindCertInStore(certStore, &quot;StoreName.TrustedPublisher,<br>
StoreLocation.CurrentUser&quot;);<br>
            //<br>
                }<br>
<br>
        private static void FindCertInStore(X509Store store, string<br>
storeName)<br>
        {<br>
<br>
Console.WriteLine(&quot;-------------------------------------------------------&quot;);<br>
            Console.WriteLine(&quot;Listing certs in store: &quot; + storeName);<br>
            Console.WriteLine(&quot;Number of certs in store: &quot; +<br>
store.Certificates.Count.ToString());<br>
            store.Open(OpenFlags.ReadOnly);<br>
            foreach (X509Certificate2 cert in store.Certificates)<br>
            {<br>
                string certName = cert.Subject.ToString();<br>
                Console.WriteLine(&quot;Certificate: &quot; + certName);<br>
            }<br>
            store.Close();<br>
<br>
Console.WriteLine(&quot;-------------------------------------------------------&quot;);<br>
            Console.WriteLine();<br>
            Console.WriteLine();<br>
        }<br>
<br>
        }<br>
}<br>
&lt;/CODE&gt;<br>
<font color="#888888"><br>
--<br>
View this message in context: <a href="http://mono.1490590.n4.nabble.com/System-Security-Cryptography-X509Certificates-Mono-2-10-2-tp4226108p4226108.html" target="_blank">http://mono.1490590.n4.nabble.com/System-Security-Cryptography-X509Certificates-Mono-2-10-2-tp4226108p4226108.html</a><br>

Sent from the Mono - Dev mailing list archive at Nabble.com.<br>
_______________________________________________<br>
Mono-devel-list mailing list<br>
<a href="mailto:Mono-devel-list@lists.ximian.com">Mono-devel-list@lists.ximian.com</a><br>
<a href="http://lists.ximian.com/mailman/listinfo/mono-devel-list" target="_blank">http://lists.ximian.com/mailman/listinfo/mono-devel-list</a><br>
</font></blockquote></div><br></div>