 |
 |
 |
 |
How to use FTPS (with server
validation - part B) |
 |
 |
 |
 |
Every
certificate has a CommonName (CN) attribute. It is common for
this attribute to be set
to the host-name of the server. If, for example, the name of
the server is ftp.mycompany.com the CN would be ftp.mycompany.com also. When the CN is not
the same as the host-name then the SSLFTPStandardValidator
will not successfully validate the
server certificate, and the connection attempt will fail.
As
it is not uncommon for the hostname to differ from the CN, the name to
match to the CN can be explicitly supplied to the validator. A new
instance must be created, as shown below:
Here,
a commonName
variable holds the string to be matched to the CN of the
server certificate.