Quantcast
Channel: Recent Threads — Xamarin Community Forums
Viewing all articles
Browse latest Browse all 204402

Creating a PKCS12 object for a cross-platform project

$
0
0

I have an app, that makes use of client-side certificates to authenticate to my service. Currently, I am using the Openssl.NET library to provide most of the functionality I need, and so far, its worked pretty well, in that I am able to create an rsa keypair and a corresponding cert.

For my service communication, I am doing the following: HttpWebRequest myRequest = (HttpWebRequest)WebRequest.Create(myurl); X509Certificate2 myp12 = new X509Certificate2(certBytes, "password"); myRequest.ClientCertificates.Add(myp12);

The issue is that an exception is thrown on the "Add" method, saying my p12 object has an invalid format. I am creating the p12 using the openssl.net PKCS12 class, and while it appears to create the object correctly, it looks like the export fails. Since I am using openssl.net, the export is as follows: BIO mybio = new BIO.MemoryBuffer(); PKCS12 mypkcs12 = new PKCS12(....); mypkcs12.Write(mybio); pkcs12string = mybio.ReadString();

Does anyone have any familiarity with the openssl.net library, and can tell me what I am doing wrong? Or if theres a way in .NET that is cross-platform, where, given a cert and key, can create a PKCS12 object, which I can then use to create a X509Certificate2 object?

Thanks in advance for any help,


Viewing all articles
Browse latest Browse all 204402

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>