CertificateRawData Property
Gets the raw X.509 certificate data as a byte array.

Namespace: MailBee.Security
Assembly: MailBee.NET (in MailBee.NET.dll) Version: 11.2.0 build 590 for .NET 4.5
Syntax
public byte[] RawData { get; }

Property Value

Type: Byte
The certificate as an array of bytes.
Examples

This sample selects the first certificate from the system store called "MY" ("Personal" tab of Certificates dialog in Internet Explorer) and saves the certificate raw data into the specified file to disk.

Note Note
To save the certificate to disk, this sample uses standard binary writer for demonstration purposes only. The developer can call the SaveToFile(String, CertFileType, String) method to save the certificate to disk.
// To use the code below, import MailBee namespace at the top of your code.
using System.IO;
using MailBee.Security;

// The actual code (put it into a method of your class).
CertificateStore store = new CertificateStore(CertificateStore.Personal, CertStoreType.System, null);
CertificateCollection collection = store.GetAllCertificates();
if (collection.Count > 0)
{
    Certificate cert = collection[0];
    using (BinaryWriter bw = new BinaryWriter(File.Open(@"C:\Temp\newcert.cer", FileMode.Create)))
    {
        bw.Write(cert.RawData);
        bw.Flush();
    }
}
See Also