See Also

CertificateReceivedEventArgs Class  | CertificateReceivedEventArgs 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

ValidDate Property

Dart.PowerTCP.SslSockets Namespace > CertificateReceivedEventArgs Class : ValidDate Property

Returns whether or not the current time-date is within the certificate's life span.

[Visual Basic]
Public ReadOnly Property ValidDate As Boolean
[C#]
public bool ValidDate {get;}
[C++]
public: __property bool get_ValidDate();
[C++/CLI]
public: property bool ValidDate {    bool get(); }

Return Type

A boolean indicating whether or not the certificate has a valid date.

Remarks

If the current date-time is greater than Certificate.IssueDate and less than Certificate.ExpirationDate, this property will return true. Otherwise, this property will return false indicating an invalid date.

Example

The following example demonstrates creating a simple secure client.

[Visual Basic] 

Private Sub CertificateReceived(ByVal sender As Object, ByRef e As CertificateReceivedEventArgs) Handles Tcp1.CertificateReceived
   Dim msg As String = "The certificate was invalid for the following reason(s)" + vbCrLf

   ' Check to see if the certificate is from a trusted root.
   If Not e.TrustedRoot Then
      msg += "This certificate is not from a trusted root" + vbCrLf
   End If

   ' Check to see if the certificate has a valid date.
   If Not e.ValidDate Then
      msg += "This certificate does not have a valid date" + vbCrLf
   End If

   ' Check to see if the certificate has a valid name.
   If Not e.ValidName Then
      msg += "This certificate does not have a valid name" + vbCrLf
   End If

   If msg <> "" Then
      msg += "Would you like to accept this certificate anyway?"
      If MessageBox.Show(msg, "Invalid Cert Received", MessageBoxButtons.YesNo) = DialogResult.Yes Then
         e.Accept = True
      End If
   End If
End Sub

[C#] 


private void CertificateReceived(object sender, CertificateReceivedEventArgs e)
{
  
string msg = "The certificate was invalid for the following reason(s)\n";

  
// Check to see if the certificate is from a trusted root.
  
if(!e.TrustedRoot)
     msg+=
"This certificate is not from a trusted root\n";

  
// Check to see if the certificate has a valid date.
  
if(!e.ValidDate)
     msg+=
"This certificate does not have a valid date\n";

  
// Check to see if the certificate has a valid name.
  
if(!e.ValidName)
     msg+=
"This certificate does not have a valid name\n";

  
if(!e.Accept)
  {
     msg +=
"Would you like to accept this certificate anyway?";
     
if(MessageBox.Show(msg, "Invalid Cert Received", MessageBoxButtons.YesNo) == DialogResult.Yes)
        e.Accept = true;
  }
}
                

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

CertificateReceivedEventArgs Class  | CertificateReceivedEventArgs Members


Send comments on this topic.

Documentation version 1.1.2.0.

© 2008 Dart Communications.  All rights reserved.