|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.glite.security.util.HostNameChecker
public class HostNameChecker
A class to do hostname checking against a certificate to check whether the server answers with a certificate that is allowed for that host. Follows the server identity part of RFC 2818.
Field Summary | |
---|---|
static java.util.regex.Pattern |
ipPattern
The pattern to check whether the string appears to be an IP address. |
static byte[] |
localhostIPv4
The localhost IPv4 address (only the exact address supported, not the whole block 127.0.0.0/8 as recognized in RFC 3330). |
static byte[] |
localhostIPv6
The localhost IPv6 address |
Constructor Summary | |
---|---|
HostNameChecker()
|
Method Summary | |
---|---|
static void |
checkHostname(java.lang.String hostname,
javax.net.ssl.SSLSocket socket)
Given a hostname and an open socket checks if the host presented a certificate that allows it to act as the host. |
static boolean |
checkHostName(java.lang.String inHostname,
java.security.cert.X509Certificate cert)
Checks whether the hostname is allowed by the certificate. |
Methods inherited from class java.lang.Object |
---|
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public static final java.util.regex.Pattern ipPattern
public static final byte[] localhostIPv4
public static final byte[] localhostIPv6
Constructor Detail |
---|
public HostNameChecker()
Method Detail |
---|
public static void checkHostname(java.lang.String hostname, javax.net.ssl.SSLSocket socket) throws java.io.IOException
hostname
- The name (or in rare cases an IP address) the connection was opened to.socket
- The socket where to get the host certificate.
java.io.IOException
- Thrown if the socket is not open, if the certificate was not understood or if the certificate
vs hostname check failed.public static boolean checkHostName(java.lang.String inHostname, java.security.cert.X509Certificate cert) throws java.security.cert.CertificateParsingException
inHostname
- The hostname to check against the certificate. Can be a DNS name, IP address or an URL.cert
- The certificate the hostname is checked against.
java.security.cert.CertificateParsingException
- Thrown in case the certificate parsing fails.
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |