Exports the current System.Security.Cryptography.X509Certificates.X509Certificate object to a byte array using the specified format and a password.
- contentType
- One of the System.Security.Cryptography.X509Certificates.X509ContentType values that describes how to format the output data.
- password
- The password required to access the X.509 certificate data.
A byte array that represents the current System.Security.Cryptography.X509Certificates.X509Certificate object.
The contentType parameter accepts only the following values of the System.Security.Cryptography.X509Certificates.X509ContentType enumeration: X509ContentType.Cert, X509ContentType.SerializedCert, and X509ContentType.Pkcs12. Passing any other value causes a System.Security.Cryptography.CryptographicException to be thrown.
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 the assembly in a text editor such as Notepad.exe.