How to construct Pkcs12Store from X509Certificate2
问题 I have an object of System.Security.Cryptography.X509Certificates.X509Certificate2. I want to construct an instance of Pkcs12Store (Org.BouncyCastle.Pkcs) using this object. I tried: Approach 1: public Pkcs12Store GetPkcs12Store(X509Certificate2 cert, string password) { byte[] rawdata = cert.RawData; MemoryStream memStream = new MemoryStream(rawdata); Pkcs12Store pk12; pk12 = new Pkcs12Store(memStream, password.ToCharArray()); return pk12; } In this approach, I am getting the exception: