Populates an System.Security.Cryptography.X509Certificates.X509Certificate2 object using data from a byte array, a password, and a key storage flag.
You can use this method for certificate types such as Base64-encoded or DER-encoded X.509 certificates, or PFX/PKCS12 certificates. Note that a PFX/PKCS12 certificate can contain more than one certificate. In that case, the first certificate associated with a private key is used or, if no private key is found, the first certificate is used.
Never hard code a password within your source code. Hard-coded passwords can be retrieved from an assembly using the MSIL Disassembler (Ildasm.exe), a hex editor, or by simply opening up the assembly in a text editor such as Notepad.exe.