PowerTCP Mail for .NET
SerialNumber Property
See Also  Send comments on this topic.
Dart.PowerTCP.Mail Namespace > Certificate Class : SerialNumber Property




Returns the serial number of this certificate as a Hex-encoded string.

Syntax

Visual Basic (Declaration) 
Public ReadOnly Property SerialNumber As String
Visual Basic (Usage)Copy Code
Dim instance As Certificate
Dim value As String
 
value = instance.SerialNumber
C# 
public string SerialNumber {get;}
Managed Extensions for C++ 
public: __property string* get_SerialNumber();
C++/CLI 
public:
property String^ SerialNumber {
   String^ get();
}

Property Value

A Hex-encoded string containing the serial number of this certificate

Example

The following example demonstrates accessing a certificate and displaying info about it.
Visual BasicCopy Code
Private Sub DisplayCertificateInfo(ByVal certNum as Integer)
   
   ' Create a new CertificateStore to access certificates
   Dim store as new CertificateStore(CertificateStoreLocation.LocalMachine, CertificateStore.My)

   Try
      ' Get the requested certificate
      Dim cert as Certificate = store(certNum)

      ' Display info about the certificate
      Dim msg as String
      msg+= "The following information about the certificate is available." + vbCrLF + vbCrLf
      msg+= "Name: " + cert.Name + vbCrLf 
      msg+= "Description: " + cert.Description + vbCrLf
      msg+= "Expires: " + cert.ExpirationDate + vbCrLf
      msg+= "Issued: " + cert.IssueDate + vbCrLf
      msg+= "Issues to: " + cert.IssuedTo + vbCrLf
      msg+= "Serial number: " + cert.SerialNumber + vbCrLf
      msg+= "Version: " + cert.Versio
      MessageBox.Show(msg)
   Catch ex as Exception
      MessageBox.Show("Error. No certificate found at index " + certNum)
   End Try
End Sub
C#Copy Code
private void DisplayCertificateInfo(int certNum)
{
   // Create a new CertificateStore to access certificates
   CertificateStore store = new CertificateStore(CertificateStoreLocation.LocalMachine, CertificateStore.My);

   try
   {
      // Get the requested certificate
      Certificate cert = store[certNum];

      // Display info about the certificate
      string msg = "";
      msg+= "The following information about the certificate is available.\r\n\r\n";
      msg+= "Name: " + cert.Name + "\r\n";
      msg+= "Description: " + cert.Description + "\r\n";
      msg+= "Expires: " + cert.ExpirationDate + "\r\n";
      msg+= "Issued: " + cert.IssueDate + "\r\n";
      msg+= "Issues to: " + cert.IssuedTo + "\r\n";
      msg+= "Serial number: " + cert.SerialNumber + "\r\n";
      msg+= "Version: " + cert.Version;
      MessageBox.Show(msg);
   }
   catch(Exception ex)
   {
      MessageBox.Show("Error. No certificate found at index " + certNum);
   }
}

Remarks

The serial number is an identification number used for a certificate. All certificates issued by a given CA have unique serial numbers so combining this property with Certificate.IssuerName results in a string which can be used to uniquely identify a certificate.

Sample data: "08ea11"

Requirements

Target Platforms: Microsoft .NET Framework 2.0

See Also

Documentation Version 3.2
© 2010 Dart Communications. All Rights Reserved.