MailBee.NET Objects 3.1

Certificate Class

Provides methods and properties for accessing a digital certificate.

For a list of all members of this type, see Certificate Members.

System.Object
   MailBee.Security.Certificate

public class Certificate : IDisposable

Thread Safety

Public static (Shared in Visual Basic) members of this type are safe for multithreaded operations. Instance members are not guaranteed to be thread-safe.

Remarks

Certificate class represents a digital certificate in MailBee.

Digital certificate is a statement which uses a digital signature to bind together a public key of an entity with information about this entity. After the trusted organization (also called a certification authority, CA) has verified the entity, it issues the requested certificate to the entity.

Certificates can contain different types of data, such as the serial number of the certificate, the algorithm used to sign the certificate, the name of the CA that issued the certificate, the name and public key of the entity requesting the certificate, and the CA's signature.

EmailAddress and HasPrivateKey are the most important properties of the certificate.

Note   To use this class, make sure MailBee.NET Security Powerup is licensed (see LicenseKey property for details).

Example

This sample loads the certificate from the specified file and displays its fields.

[C#]
// To use the code below, import MailBee namespace at the top of your code.
using MailBee.Security;

// The actual code (put it into a method of your class).
Certificate cert = new Certificate(@"C:\Temp\certificate.cer", CertFileType.Cer, null);

Console.WriteLine("Email address: " + cert.EmailAddress);
Console.WriteLine("Private key available: " + cert.HasPrivateKey);
Console.WriteLine("Issued by: " + cert.IssuedBy);
Console.WriteLine("Issued to: " + cert.IssuedTo);
Console.WriteLine("Issuer: " + cert.IssuedBy);
Console.WriteLine("Key algorithm: " + cert.KeyAlgorithmString);
Console.WriteLine("Name: " + cert.Name);
Console.WriteLine("Public key: " + cert.PublicKeyString);
Console.WriteLine("Serial number: " + cert.SerialNumberString);
Console.WriteLine("Subject: " + cert.Subject);
Console.WriteLine("Valid from " + cert.ValidFromDate + " till " + cert.ValidToDate);
[Visual Basic]
' To use the code below, import MailBee namespace at the top of your code.
Imports MailBee.Security

' The actual code (put it into a method of your class).
Dim cert As Certificate = New Certificate("C:\Temp\certificate.cer", CertFileType.Cer, Nothing)

Console.WriteLine("Email address: " & cert.EmailAddress)
Console.WriteLine("Private key available: " & cert.HasPrivateKey.ToString())
Console.WriteLine("Issued by: " & cert.IssuedBy)
Console.WriteLine("Issued to: " & cert.IssuedTo)
Console.WriteLine("Issuer: " & cert.IssuedBy)
Console.WriteLine("Key algorithm: " & cert.KeyAlgorithmString)
Console.WriteLine("Name: " & cert.Name)
Console.WriteLine("Public key: " & cert.PublicKeyString)
Console.WriteLine("Serial number: " & cert.SerialNumberString)
Console.WriteLine("Subject: " & cert.Subject)
Console.WriteLine("Valid from " & cert.ValidFromDate & " till " & cert.ValidToDate)

Requirements

Namespace: MailBee.Security

Assembly: MailBee.NET (in MailBee.NET.dll)

See Also

Certificate Members | MailBee.Security Namespace | CertificateStore | ClientServerCertificates | X509Certificate