Return the status of the server certificate.
Syntax
object.CertificateStatus
Remarks
The CertificateStatus property returns an integer value
which identifies the status of the server certificate. This property
may return one of the following values:
Value |
Description |
stCertificateNone |
No certificate information is available. A secure connection
was not established with the server. |
stCertificateValid |
The certificate is valid. |
stCertificateNoMatch |
The certificate is valid, however the domain name specified
in the certificate does not match the domain name of the site
that the client has connected to. This is typically the case if
the ServerName property is set to an IP address rather
than a host name. It is recommended that the client examine the
CertificateSubject property to determine the domain name
of the site that the certificate was issued for. |
stCertificateExpired |
The certificate has expired and is no longer valid. The
client can examine the CertificateExpires property to
determine when the certificate expired. |
stCertificateRevoked |
The certificate has been revoked and is no longer valid. It
is recommended that the client application immediately terminate
the connection if this status is returned. |
stCertificateUntrusted |
The certificate has not been issued by a trusted authority,
or the certificate is not trusted on the local host. It is
recommended that the client application immediately terminate the
connection if this status is returned. |
stCertificateInvalid |
The certificate is invalid. This typically indicates that the
internal structure of the certificate is damaged. It is
recommended that the client application immediately terminate the
connection if this status is returned. |
This property value should be checked after the connection to the
server has completed, but prior to beginning a transaction. If a
secure connection has not been established, this property will return
a value of zero.
Data Type
Integer (Int32)
Example
The following example establishes a secure connection to a server
and retrieves a file:
FileTransfer1.HostName = strHostName
On Error Resume Next: Err.Clear
FileTransfer1.Secure = True
If Err.Number Then
MsgBox "Unable to initialize the security interface"
Exit Sub
End If
On Error GoTo 0
nError = FileTransfer1.Connect()
If nError > 0 Then
MsgBox "Unable to connect to server " & strHostName, vbExclamation
Exit Sub
End If
If FileTransfer1.CertificateStatus <> stCertificateValid Then
lResult = MsgBox("The server certificate could not be validated" & vbCrLf & _
"Are you sure you wish to continue?", vbYesNo)
If lResult = vbNo Then
FileTransfer1.Disconnect
Exit Sub
End If
End If
nError = FileTransfer1.GetFile(strLocalFile, strRemoteFile)
If nError > 0 Then
FileTransfer1.Disconnect
MsgBox "Unable to retrieve file from server " & strHostName
Exit Sub
End If
FileTransfer1.Disconnect
See Also
CertificateExpires Property,
CertificateIssued Property,
CertificateIssuer Property,
CertificateSubject Property,
Secure Property
|