See Also

Certificate Class  | Certificate Members

Requirements

Platforms: Windows 98, Windows NT 4.0, Windows Millennium Edition, Windows 2000, Windows XP Home Edition, Windows XP Professional, Windows Server 2003 family

Language

Visual Basic

C#

C++

C++/CLI

Show All

See Also Languages PowerTCP SSL Sockets for .NET

Name Property

Dart.PowerTCP.SslSockets Namespace > Certificate Class : Name Property (Certificate)

Returns the friendly name of this certificate.

[Visual Basic]
Public ReadOnly Property Name As String
[C#]
public string Name {get;}
[C++]
public: __property string* get_Name();
[C++/CLI]
public: property String^ Name {    String^ get(); }

Return Type

A string containing the friendly name of this certificate.

Remarks

This is the human-readable name of the certificate. Sometimes this is the same as IssuedTo, if nothing was specified as a "friendlyname" when the certificate was created.

Sample data: "Thawte Server CA"

Example

The following example demonstrates accessing a certificate and displaying info about it.

[Visual Basic] 

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#] 


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);
  }
}
                

Requirements

Platforms: Windows 98, Windows NT 4.0, Windows Millennium Edition, Windows 2000, Windows XP Home Edition, Windows XP Professional, Windows Server 2003 family

See Also

Certificate Class  | Certificate Members


Send comments on this topic.

Documentation version 1.1.2.0.

© 2008 Dart Communications.  All rights reserved.