SV: [Mono-list] PKCS#12 example

Hellan.Kim KHE KHE at kmd.dk
Wed Sep 21 10:59:17 EDT 2005


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?

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

-- 
Sebastien Pouliot
email: sebastien at ximian.com
blog: http://pages.infinit.net/ctech/





_______________________________________________________________________________________
www.kmd.dk   www.kundenet.kmd.dk   www.eboks.dk   www.civitas.dk   www.netborger.dk www.organisator.dk

Hvis du har modtaget denne mail ved en fejl vil jeg gerne, at du informerer mig og sletter den.
KMD skaber it-services, der fremmer effektivitet hos det offentlige, erhvervslivet og borgerne.

If you received this e-mail by mistake, please notify me and delete it. Thank you.
Our mission is to enhance the efficiency of the public sector and improve its service of the general public. 



More information about the Mono-list mailing list