/** * Verify the certificate allows use of the supplied IP address. * * <p>From RFC2818: In some cases, the URI is specified as an IP address rather than a hostname. In this case, the * iPAddress subjectAltName must be present in the certificate and must exactly match the IP in the URI.</p> * * @param ip address to match in the certificate * @param cert to inspect for the IP address * * @return whether the ip matched a subject alt name */ protected boolean verifyIP(final String ip, final X509Certificate cert) { final String[] subjAltNames = getSubjectAltNames(cert, SubjectAltNameType.IP_ADDRESS); logger.debug("verifyIP using subjectAltNames={}", Arrays.toString(subjAltNames)); for (String name : subjAltNames) { if (ip.equalsIgnoreCase(name)) { logger.debug("verifyIP found hostname match: {}", name); return true; } } return false; }
/** * Verify the certificate allows use of the supplied IP address. * * <p>From RFC2818: In some cases, the URI is specified as an IP address rather than a hostname. In this case, the * iPAddress subjectAltName must be present in the certificate and must exactly match the IP in the URI.</p> * * @param ip address to match in the certificate * @param cert to inspect for the IP address * * @return whether the ip matched a subject alt name */ protected boolean verifyIP(final String ip, final X509Certificate cert) { final String[] subjAltNames = getSubjectAltNames(cert, SubjectAltNameType.IP_ADDRESS); logger.debug("verifyIP using subjectAltNames={}", Arrays.toString(subjAltNames)); for (String name : subjAltNames) { if (ip.equalsIgnoreCase(name)) { logger.debug("verifyIP found hostname match: {}", name); return true; } } return false; }
/** * Verify the certificate allows use of the supplied IP address. * * <p>From RFC2818: In some cases, the URI is specified as an IP address rather than a hostname. In this case, the * iPAddress subjectAltName must be present in the certificate and must exactly match the IP in the URI.</p> * * @param ip address to match in the certificate * @param cert to inspect for the IP address * * @return whether the ip matched a subject alt name */ protected boolean verifyIP(final String ip, final X509Certificate cert) { final String[] subjAltNames = getSubjectAltNames(cert, SubjectAltNameType.IP_ADDRESS); logger.debug("verifyIP using subjectAltNames={}", Arrays.toString(subjAltNames)); for (String name : subjAltNames) { if (ip.equalsIgnoreCase(name)) { logger.debug("verifyIP found hostname match: {}", name); return true; } } return false; }
final String[] subjAltNames = getSubjectAltNames(cert, SubjectAltNameType.DNS_NAME); logger.debug("verifyDNS using subjectAltNames={}", Arrays.toString(subjAltNames)); if (subjAltNames.length > 0) {
final String[] subjAltNames = getSubjectAltNames(cert, SubjectAltNameType.DNS_NAME); logger.debug("verifyDNS using subjectAltNames={}", Arrays.toString(subjAltNames)); if (subjAltNames.length > 0) {
final String[] subjAltNames = getSubjectAltNames(cert, SubjectAltNameType.DNS_NAME); logger.debug("verifyDNS using subjectAltNames={}", Arrays.toString(subjAltNames)); if (subjAltNames.length > 0) {