Updated exception handling in DefaultHostnameVerifier
import org.bouncycastle.asn1.x500.RDN;
import org.bouncycastle.asn1.x500.X500Name;
import org.bouncycastle.asn1.x500.style.BCStyle;
+import org.bouncycastle.est.ESTException;
import org.bouncycastle.util.Strings;
@@ -32,23 +33,23 @@ public boolean verified(String name, SSLSession context)
new ByteArrayInputStream(((javax.security.cert.X509Certificate)context.getPeerCertificateChain()[0]).getEncoded()));
return verify(name, cert);
- } catch (Exception ex) {
- if (ex instanceof IOException) {
- throw (IOException)ex;
}
- throw new IOException(ex.getMessage(),ex);
+ catch (Exception ex)
+ {
+ if (ex instanceof ESTException)
+ {
+ throw (ESTException)ex;
+ }
+ throw new ESTException(ex.getMessage(), ex);
}
}
public boolean verify(String name, X509Certificate cert)
throws IOException
{
-
-
//
// Test against san.
//
-
try
{
Collection<List<?>> n = cert.getSubjectAlternativeNames();
@@ -78,7 +79,7 @@ public boolean verify(String name, X509Certificate cert)
}
catch (Exception ex)
{
- throw new IOException(ex.getMessage(), ex);
+ throw new ESTException(ex.getMessage(), ex);
}
// Common Name match only.
@@ -109,7 +110,6 @@ public boolean testName(String name, String dnsName)
return Strings.toLowerCase(name).endsWith(Strings.toLowerCase(dnsName.substring(1)));
}
-
return name.equalsIgnoreCase(dnsName);
}
}
