Home | History | Annotate | Download | only in ssl

Lines Matching defs:cn

84             String cn = new DistinguishedNameParser(principal).findMostSpecific("cn");
85 if (cn != null) {
86 return verifyHostName(hostName, cn);
123 * Returns true if {@code hostName} matches the name or pattern {@code cn}.
126 * @param cn certificate host name. May include wildcards like
129 public boolean verifyHostName(String hostName, String cn) {
130 if (hostName == null || hostName.isEmpty() || cn == null || cn.isEmpty()) {
134 cn = cn.toLowerCase(Locale.US);
136 if (!cn.contains("*")) {
137 return hostName.equals(cn);
140 if (cn.startsWith("*.") && hostName.regionMatches(0, cn, 2, cn.length() - 2)) {
144 int asterisk = cn.indexOf('*');
145 int dot = cn.indexOf('.');
147 return false; // malformed; wildcard must be in the first part of the cn
150 if (!hostName.regionMatches(0, cn, 0, asterisk)) {
154 int suffixLength = cn.length() - (asterisk + 1);
163 if (!hostName.regionMatches(suffixStart, cn, asterisk + 1, suffixLength)) {