X509Certificate2 cert = new X509Certificate2("myCertificate.pfx"); byte[] rawData = cert.GetRawCertData();
X509Certificate2 cert = new X509Certificate2("myCertificate.pfx", "password"); byte[] rawData = cert.GetRawCertData();This code is similar to the previous example, but it also specifies a password for the certificate file. This is necessary if the certificate is protected by a password. The package library used in this example is the .NET Framework library, which includes the System.Security.Cryptography.X509Certificates namespace.