Code example for X509Certificate

Methods: getSubjectDN

							catch (SSLPeerUnverifiedException e) { 
								throw new RuntimeException(String.format( 
										"Failed to verify peer for url: %s (%s)", e, u.toString())); 
							Matcher m = DNPattern.matcher(cert.getSubjectDN().getName()); 
							if (!m.find()) { 
								throw new RuntimeException(String.format( 
										"Could not extract hostname from '%s' for url %s", cert.getSubjectDN(), u.toString())); 
							String sslname =; 
							if (sslname.equals(override_certname)) { 
								/* Matched the overridden certname, so allow this connection */ 
								return true; 
							 * Could return false here, but that won't show as 
							 * useful error message, so throw RuntimeEception 
							 * instead