Example usage for org.bouncycastle.operator RuntimeOperatorException getCause

List of usage examples for org.bouncycastle.operator RuntimeOperatorException getCause

Introduction

In this page you can find the example usage for org.bouncycastle.operator RuntimeOperatorException getCause.

Prototype

public Throwable getCause() 

Source Link

Usage

From source file:org.jscep.client.Client.java

License:Open Source License

private boolean isSelfSigned(final X509Certificate cert) throws ClientException {
    try {//  ww  w  .j a v a 2  s.  com
        JcaX509CertificateHolder holder = new JcaX509CertificateHolder(cert);
        ContentVerifierProvider verifierProvider = new JcaContentVerifierProviderBuilder().build(holder);

        return holder.isSignatureValid(verifierProvider);
    } catch (RuntimeOperatorException e) {
        if (e.getCause() instanceof SignatureException) {
            LOGGER.warn("SignatureException detected so we consider that the certificate is not self signed");
            return false;
        }
        throw new ClientException(e);
    } catch (Exception e) {
        throw new ClientException(e);
    }
}