throw new CertificateValidationCallback.CertificateValidationException( "Could not create PKIX CertPathBuilder", ex);
}catch(Exception e){ log.log(Level.SEVERE, "WSS1518.failedto.validate.certificate", e); throw new CertificateValidationCallback.CertificateValidationException(e.getMessage(), e);
certValidator = CertPathValidator.getInstance("PKIX"); }catch(Exception e){ throw new CertificateValidationCallback.CertificateValidationException(e.getMessage(), e);
} catch (CertificateExpiredException e) { log.log(Level.SEVERE, "WSS1517.X509.expired", e); throw new CertificateValidationCallback.CertificateValidationException("X509Certificate Expired", e); } catch (CertificateNotYetValidException e) { log.log(Level.SEVERE, "WSS1527.X509.notValid", e); throw new CertificateValidationCallback.CertificateValidationException("X509Certificate Not Yet Valid", e); throw new CertificateValidationCallback.CertificateValidationException(e.getMessage(), e); } catch (Exception e) { log.log(Level.SEVERE, "WSS1518.failedto.validate.certificate", e); throw new CertificateValidationCallback.CertificateValidationException(e.getMessage(), e);
throw new CertificateValidationCallback.CertificateValidationException( "Could not create PKIX CertPathBuilder", ex);
throw new CertificateValidationCallback.CertificateValidationException( "Could not create PKIX CertPathBuilder", ex);
throw new CertificateValidationCallback.CertificateValidationException(ex); throw new CertificateValidationCallback.CertificateValidationException(ex);
throw new CertificateValidationCallback.CertificateValidationException(ex); throw new CertificateValidationCallback.CertificateValidationException(ex);
throw new CertificateValidationCallback.CertificateValidationException(ex); throw new CertificateValidationCallback.CertificateValidationException(ex);
private boolean isOwnedCert(X509Certificate cert) throws CertificateValidationCallback.CertificateValidationException { if (keyStore == null) { return false; } try { Enumeration<String> aliases = keyStore.aliases(); while (aliases.hasMoreElements()) { String alias = aliases.nextElement(); if (keyStore.isKeyEntry(alias)) { X509Certificate x509Cert = (X509Certificate) keyStore.getCertificate(alias); if (x509Cert != null) { if (x509Cert.equals(cert)) { return true; } } } } return false; } catch (GeneralSecurityException e) { throw new CertificateValidationCallback.CertificateValidationException( "Could not determine whether certificate is contained in main key store", e); } } }
private boolean isOwnedCert(X509Certificate cert) throws CertificateValidationCallback.CertificateValidationException { if (keyStore == null) { return false; } try { Enumeration<String> aliases = keyStore.aliases(); while (aliases.hasMoreElements()) { String alias = aliases.nextElement(); if (keyStore.isKeyEntry(alias)) { X509Certificate x509Cert = (X509Certificate) keyStore.getCertificate(alias); if (x509Cert != null) { if (x509Cert.equals(cert)) { return true; } } } } return false; } catch (GeneralSecurityException e) { throw new CertificateValidationCallback.CertificateValidationException( "Could not determine whether certificate is contained in main key store", e); } } }
private boolean isOwnedCert(X509Certificate cert) throws CertificateValidationCallback.CertificateValidationException { if (keyStore == null) { return false; } try { Enumeration<String> aliases = keyStore.aliases(); while (aliases.hasMoreElements()) { String alias = aliases.nextElement(); if (keyStore.isKeyEntry(alias)) { X509Certificate x509Cert = (X509Certificate) keyStore.getCertificate(alias); if (x509Cert != null) { if (x509Cert.equals(cert)) { return true; } } } } return false; } catch (GeneralSecurityException e) { throw new CertificateValidationCallback.CertificateValidationException( "Could not determine whether certificate is contained in main key store", e); } } }
@Override public boolean validate(X509Certificate certificate) throws CertificateValidationCallback.CertificateValidationException { boolean allUnsupported = true; for (int i = 0; i < getCallbackHandlers().length; i++) { CallbackHandler callbackHandler = getCallbackHandlers()[i]; try { callbackHandler.handle(new Callback[]{callback}); allUnsupported = false; if (!callback.getResult()) { return false; } } catch (IOException e) { throw new CertificateValidationCallback.CertificateValidationException(e); } catch (UnsupportedCallbackException e) { // ignore } } return !allUnsupported; } }
@Override public boolean validate(X509Certificate certificate) throws CertificateValidationCallback.CertificateValidationException { boolean allUnsupported = true; for (int i = 0; i < getCallbackHandlers().length; i++) { CallbackHandler callbackHandler = getCallbackHandlers()[i]; try { callbackHandler.handle(new Callback[]{callback}); allUnsupported = false; if (!callback.getResult()) { return false; } } catch (IOException e) { throw new CertificateValidationCallback.CertificateValidationException(e); } catch (UnsupportedCallbackException e) { // ignore } } return !allUnsupported; } }
@Override public boolean validate(X509Certificate certificate) throws CertificateValidationCallback.CertificateValidationException { boolean allUnsupported = true; for (int i = 0; i < getCallbackHandlers().length; i++) { CallbackHandler callbackHandler = getCallbackHandlers()[i]; try { callbackHandler.handle(new Callback[]{callback}); allUnsupported = false; if (!callback.getResult()) { return false; } } catch (IOException e) { throw new CertificateValidationCallback.CertificateValidationException(e); } catch (UnsupportedCallbackException e) { // ignore } } return !allUnsupported; } }
public boolean getResult() { try { if (validator != null) result = validator.validate(certificate); } catch (CertificateValidationCallback.CertificateValidationException ex) { throw SOAPUtil.newSOAPFaultException(MessageConstants.WSSE_INVALID_SECURITY_TOKEN, ex.getMessage(), ex); } catch (Exception e) { throw SOAPUtil.newSOAPFaultException(MessageConstants.WSSE_INVALID_SECURITY_TOKEN, e.getMessage(), e); } return result; }