public class HostnameChecker
extends java.lang.Object
| Modifier and Type | Field and Description |
|---|---|
static byte |
TYPE_LDAP |
static byte |
TYPE_TLS |
| Modifier and Type | Method and Description |
|---|---|
static HostnameChecker |
getInstance(byte checkType)
Get a HostnameChecker instance.
|
static X500Name |
getSubjectX500Name(java.security.cert.X509Certificate cert)
Return the subject of a certificate as X500Name, by reparsing if
necessary.
|
void |
match(java.lang.String expectedName,
java.security.cert.X509Certificate cert) |
void |
match(java.lang.String expectedName,
java.security.cert.X509Certificate cert,
boolean chainsToPublicCA)
Perform the check.
|
public static final byte TYPE_TLS
public static final byte TYPE_LDAP
public static HostnameChecker getInstance(byte checkType)
public void match(java.lang.String expectedName,
java.security.cert.X509Certificate cert,
boolean chainsToPublicCA)
throws java.security.cert.CertificateException
expectedName - the expected host name or ip addresscert - the certificate to check againstchainsToPublicCA - true if the certificate chains to a public
root CA (as pre-installed in the cacerts file)java.security.cert.CertificateException - if the name does not match any of
the names specified in the certificatepublic void match(java.lang.String expectedName,
java.security.cert.X509Certificate cert)
throws java.security.cert.CertificateException
java.security.cert.CertificateExceptionpublic static X500Name getSubjectX500Name(java.security.cert.X509Certificate cert) throws java.security.cert.CertificateParsingException
java.security.cert.CertificateParsingException