Hi,
I'm using a code similar to the following snippet: >>>>> // create a PKCS12Store Pkcs12Store tp12 = new Pkcs12Store (); // get your private key AsymmetricKeyParameter privateKey = .. // add your private key here // add certificate chain X509CertificateEntry[] xe = new X509CertificateEntry[certChain.Count]; for ( int k = 0; k < certChain.Count; k++ ) { xe[k] = new X509CertificateEntry ( certChain[k] ); } tp12.SetKeyEntry ( alias, new AsymmetricKeyEntry ( privateKey ), xe ); byte[] res = null; try { MemoryStream s = new MemoryStream (); tp12.Save ( s, password, GetRandom ( 16 ) ); res = s.GetBuffer (); res = Pkcs12Utilities.ConvertToDefiniteLength ( res, password ); } <<<<< 'res' will finally hold the resulting PKCS#12 file. Hope this helps. Regards, Torsten Am 13.01.2013 20:31, schrieb Ignacio Ocampo:
Hi, I need to know, how I can generate a .PFX from .CER and .KEY files in C#, with BouncyCastle libraries. Can you help me? Thank you. -- Ignacio Ocampo Millán