Code example for CertificateException

0
										byte[] digest = md.digest();
										BigInteger bi = new BigInteger(1, digest);
									    String fingerprint = String.format("%0" + (digest.length << 1) + "X", bi);
 
									    if (!fingerprint.equals(whitelisted_cert)) {
									    	throw new CertificateException("Certificate fingerprint does not match the configured one!");
									    } 
 
									    /* Otherwise, if it matches, we said override, so trust everything */ 
									} 
 
									public X509Certificate[] getAcceptedIssuers() {
										return new X509Certificate[0];
									} 
								} }, null); 
					} catch (KeyManagementException e) {
						throw new RuntimeException(String.format("Unable to set up key management: %s", e.toString()));
					} 
					sslconn.setSSLSocketFactory(context.getSocketFactory()); 
				} 
			}