SV: [Mono-list] PKCS#12 example
Sebastien Pouliot
sebastien.pouliot at gmail.com
Thu Sep 22 15:25:14 EDT 2005
Hello Kim,
On Wed, 2005-21-09 at 16:59 +0200, Hellan.Kim KHE wrote:
> I did something similar to this:
>
> PKCS12 p12 = new PKCS12 ();
> p12.Password = p12pwd;
> p12.AddCertificate (new X509Certificate (rawcert));
> p12.AddPkcs8ShroudedKeyBag (subjectKey);
> p12.SaveToFile (p12file);
>
> However, the certificate does not get "associated" with the private key
> (subjectKey) that I add to the PKCS#12.
> The key and certificate do "belong" together (same public key).
>
> So whenever I try to install this PKCS#12, the certificate is put in the
> "Other people" category instead of "Personal" due to the "missing"
> private key.
>
> Any ideas what could be wrong?
Microsoft import tool doesn't automatically associate the key with the
certificate (even if there's just one of each).
This isn't really PKCS#12 related but makecert should generate files
usable on Windows, so please fill a bug in bugzilla for makecert.
> Thanks!
> Kim
>
> -----Oprindelig meddelelse-----
> Fra: Sebastien Pouliot [mailto:sebastien.pouliot at gmail.com]
> Sendt: 20. september 2005 15:53
> Til: Hellan.Kim KHE
> Cc: mono-list at lists.ximian.com
> Emne: Re: [Mono-list] PKCS#12 example
>
> Hello Kim,
>
> On Tue, 2005-20-09 at 14:13 +0200, Hellan.Kim KHE wrote:
> > I need to create the following simple PKCS#12:
> >
> > - Containing private key and certificate
> >
> > - Containing 1 additional certificate
> >
> > - With a "Friendly Name" specified
> >
> > - Password protected
> >
> >
> >
> > Does anyone have a small example for that, or can you direct to where
> > I can find examples for Mono cryptograpy?
>
> Mono's makecert tool supports creating PKCS#12 files.
> http://svn.myrealbox.com/source/trunk/mcs/tools/security/makecert.cs
>
> This should answers most of your questions - except for the friendly
> name. For this you'll need to look at the source code...
> http://svn.myrealbox.com/source/trunk/mcs/class/Mono.Security/Mono.Secur
> ity.X509/PKCS12.cs
>
More information about the Mono-list
mailing list