Example: inspecting X.509 certificate properties

The previous example calls the following function to print a description of an SSL certificate represented in a CtsSecurity::X509Certificate instance:

Private Function certInfo( _
  cert As CtsSecurity.X509Certificate _
  ) As String   Dim description As String
   Dim prop As String
   
   description = ""
   
   prop = cert.getSubjectDN()
   description = description _
     & "  Subject name: " & prop & vbCrLf

   prop = cert.getIssuerDN()
   description = description _
     & "  Issuer name: " & prop & vbCrLf

   description = description _
     & "  Not valid before: " & Format(cert.getNotBefore()) & vbCrLf
   
   description = description _
     & "  Not valid after: " & Format(cert.getNotAfter()) & vbCrLf
     
   certInfo = description
   
End Function