English 中文(简体)
issue with certificate
原标题:

I´m developing a tool (ASP.NET page that generates a file with stamped with a private key to be validated later on other app.

I´m using makecert for the certificate creation:

makecert -sky "privatekey" -sk "MyCompany"-n "CN=MyCompany" -ss -pe CertFile.cert

The generated cert is on my dev machine. Then I run this code and It can be found with no problem:

X509Store store = new X509Store(StoreName.My, StoreLocation.CurrentUser);
X509Certificate2Collection certs;

store.Open(OpenFlags.ReadOnly);

X509Certificate2Collection certs = store.Certificates.Find(X509FindType.FindBySubjectName, "MyCompany", false);

The certs variable contains no certificates (in a test environment)

I intalled the certificate on the Test Server (Win 2003) using the double click and install cert, using mmc and importing certificate, and exporting the certificate from my machine and then importing in the Test Server.

Is there a step that I´m missing?

UPDATE:

I think this can be the problem. ASPNET User does not have permission to access certificate, also the certificate is not installed on the Machine, just fot the local user.

I´m looking for this link: http://geekswithblogs.net/lorint/archive/2005/12/30/64516.aspx

Thanks

问题回答

The command line is slightly incorrect... you need to specify the storage "my" after the -ss argument:

makecert -sky "privatekey" -sk "MyCompany" -n "CN=MyCompany" -ss "my" -pe CertFile.cert

After that change I was then able to locate the certificate using the MMC Certificate snap-in.





相关问题
Anyone feel like passing it forward?

I m the only developer in my company, and am getting along well as an autodidact, but I know I m missing out on the education one gets from working with and having code reviewed by more senior devs. ...

NSArray s, Primitive types and Boxing Oh My!

I m pretty new to the Objective-C world and I have a long history with .net/C# so naturally I m inclined to use my C# wits. Now here s the question: I feel really inclined to create some type of ...

C# Marshal / Pinvoke CBitmap?

I cannot figure out how to marshal a C++ CBitmap to a C# Bitmap or Image class. My import looks like this: [DllImport(@"test.dll", CharSet = CharSet.Unicode)] public static extern IntPtr ...

How to Use Ghostscript DLL to convert PDF to PDF/A

How to user GhostScript DLL to convert PDF to PDF/A. I know I kind of have to call the exported function of gsdll32.dll whose name is gsapi_init_with_args, but how do i pass the right arguments? BTW, ...

Linqy no matchy

Maybe it s something I m doing wrong. I m just learning Linq because I m bored. And so far so good. I made a little program and it basically just outputs all matches (foreach) into a label control. ...

热门标签