public class

HostnameChecker

extends Object
java.lang.Object
   ↳ sun.security.util.HostnameChecker

Class Overview

Class to check hostnames against the names specified in a certificate as required for TLS and LDAP.

Summary

Constants
byte TYPE_LDAP
byte TYPE_TLS
Public Methods
static HostnameChecker getInstance(byte checkType)
Get a HostnameChecker instance.
static String getServerName(KerberosPrincipal principal)
Return the Server name from Kerberos principal.
static X500Name getSubjectX500Name(X509Certificate cert)
Return the subject of a certificate as X500Name, by reparsing if necessary.
void match(String expectedName, X509Certificate cert)
Perform the check.
static boolean match(String expectedName, KerberosPrincipal principal)
Perform the check for Kerberos.
[Expand]
Inherited Methods
From class java.lang.Object

Constants

public static final byte TYPE_LDAP

Constant Value: 2 (0x00000002)

public static final byte TYPE_TLS

Constant Value: 1 (0x00000001)

Public Methods

public static HostnameChecker getInstance (byte checkType)

Get a HostnameChecker instance. checkType should be one of the TYPE_* constants defined in this class.

public static String getServerName (KerberosPrincipal principal)

Return the Server name from Kerberos principal.

public static X500Name getSubjectX500Name (X509Certificate cert)

Return the subject of a certificate as X500Name, by reparsing if necessary. X500Name should only be used if access to name components is required, in other cases X500Principal is to be prefered. This method is currently used from within JSSE, do not remove.

public void match (String expectedName, X509Certificate cert)

Perform the check.

Throws
CertificateException if the name does not match any of the names specified in the certificate

public static boolean match (String expectedName, KerberosPrincipal principal)

Perform the check for Kerberos.