javax.net.ssl.SSLHandshakeException.initCause()方法的使用及代码示例

x33g5p2x  于2022-01-29 转载在 其他  
字(9.6k)|赞(0)|评价(0)|浏览(112)

本文整理了Java中javax.net.ssl.SSLHandshakeException.initCause()方法的一些代码示例,展示了SSLHandshakeException.initCause()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。SSLHandshakeException.initCause()方法的具体详情如下:
包路径:javax.net.ssl.SSLHandshakeException
类名称:SSLHandshakeException
方法名:initCause

SSLHandshakeException.initCause介绍

暂无

代码示例

代码示例来源:origin: redisson/redisson

/**
 * Converts the given exception to a {@link SSLHandshakeException}, if it isn't already.
 */
static SSLHandshakeException toSSLHandshakeException(Throwable e) {
  if (e instanceof SSLHandshakeException) {
    return (SSLHandshakeException) e;
  }
  return (SSLHandshakeException) new SSLHandshakeException(e.getMessage()).initCause(e);
}

代码示例来源:origin: wildfly/wildfly

/**
 * Converts the given exception to a {@link SSLHandshakeException}, if it isn't already.
 */
static SSLHandshakeException toSSLHandshakeException(Throwable e) {
  if (e instanceof SSLHandshakeException) {
    return (SSLHandshakeException) e;
  }
  return (SSLHandshakeException) new SSLHandshakeException(e.getMessage()).initCause(e);
}

代码示例来源:origin: eclipse-vertx/vert.x

@Override
public void userEventTriggered(ChannelHandlerContext ctx, Object evt) {
 if (evt instanceof SslHandshakeCompletionEvent) {
  // Notify application
  SslHandshakeCompletionEvent completion = (SslHandshakeCompletionEvent) evt;
  if (completion.isSuccess()) {
   // Remove from the pipeline after handshake result
   ctx.pipeline().remove(this);
   applicationProtocol = sslHandler.applicationProtocol();
   channelHandler.handle(io.vertx.core.Future.succeededFuture(channel));
  } else {
   SSLHandshakeException sslException = new SSLHandshakeException("Failed to create SSL connection");
   sslException.initCause(completion.cause());
   channelHandler.handle(io.vertx.core.Future.failedFuture(sslException));
  }
 }
 ctx.fireUserEventTriggered(evt);
}
@Override

代码示例来源:origin: redisson/redisson

@Override
public void handle(long ssl, byte[] keyTypeBytes, byte[][] asn1DerEncodedPrincipals) throws Exception {
  final ReferenceCountedOpenSslEngine engine = engineMap.get(ssl);
  try {
    final Set<String> keyTypesSet = supportedClientKeyTypes(keyTypeBytes);
    final String[] keyTypes = keyTypesSet.toArray(new String[0]);
    final X500Principal[] issuers;
    if (asn1DerEncodedPrincipals == null) {
      issuers = null;
    } else {
      issuers = new X500Principal[asn1DerEncodedPrincipals.length];
      for (int i = 0; i < asn1DerEncodedPrincipals.length; i++) {
        issuers[i] = new X500Principal(asn1DerEncodedPrincipals[i]);
      }
    }
    keyManagerHolder.setKeyMaterialClientSide(engine, keyTypes, issuers);
  } catch (Throwable cause) {
    logger.debug("request of key failed", cause);
    SSLHandshakeException e = new SSLHandshakeException("General OpenSslEngine problem");
    e.initCause(cause);
    engine.handshakeException = e;
  }
}

代码示例来源:origin: redisson/redisson

@Override
  public void handle(long ssl, byte[] keyTypeBytes, byte[][] asn1DerEncodedPrincipals) throws Exception {
    final ReferenceCountedOpenSslEngine engine = engineMap.get(ssl);
    try {
      // For now we just ignore the asn1DerEncodedPrincipals as this is kind of inline with what the
      // OpenJDK SSLEngineImpl does.
      keyManagerHolder.setKeyMaterialServerSide(engine);
    } catch (Throwable cause) {
      logger.debug("Failed to set the server-side key material", cause);
      SSLHandshakeException e = new SSLHandshakeException("General OpenSslEngine problem");
      e.initCause(cause);
      engine.handshakeException = e;
    }
  }
}

代码示例来源:origin: wildfly/wildfly

@Override
public void requested(
    long ssl, long certOut, long keyOut, byte[] keyTypeBytes, byte[][] asn1DerEncodedPrincipals) {
  final ReferenceCountedOpenSslEngine engine = engineMap.get(ssl);
  try {
    final Set<String> keyTypesSet = supportedClientKeyTypes(keyTypeBytes);
    final String[] keyTypes = keyTypesSet.toArray(new String[0]);
    final X500Principal[] issuers;
    if (asn1DerEncodedPrincipals == null) {
      issuers = null;
    } else {
      issuers = new X500Principal[asn1DerEncodedPrincipals.length];
      for (int i = 0; i < asn1DerEncodedPrincipals.length; i++) {
        issuers[i] = new X500Principal(asn1DerEncodedPrincipals[i]);
      }
    }
    keyManagerHolder.setKeyMaterialClientSide(engine, certOut, keyOut, keyTypes, issuers);
  } catch (Throwable cause) {
    logger.debug("request of key failed", cause);
    SSLHandshakeException e = new SSLHandshakeException("General OpenSslEngine problem");
    e.initCause(cause);
    engine.handshakeException = e;
  }
}

代码示例来源:origin: redisson/redisson

logger.debug("verification of certificate failed", cause);
SSLHandshakeException e = new SSLHandshakeException("General OpenSslEngine problem");
e.initCause(cause);
engine.handshakeException = e;

代码示例来源:origin: wildfly/wildfly

logger.debug("verification of certificate failed", cause);
SSLHandshakeException e = new SSLHandshakeException("General OpenSslEngine problem");
e.initCause(cause);
engine.handshakeException = e;

代码示例来源:origin: io.netty/netty-handler

/**
 * Converts the given exception to a {@link SSLHandshakeException}, if it isn't already.
 */
static SSLHandshakeException toSSLHandshakeException(Throwable e) {
  if (e instanceof SSLHandshakeException) {
    return (SSLHandshakeException) e;
  }
  return (SSLHandshakeException) new SSLHandshakeException(e.getMessage()).initCause(e);
}

代码示例来源:origin: io.vertx/vertx-core

@Override
public void userEventTriggered(ChannelHandlerContext ctx, Object evt) {
 if (evt instanceof SslHandshakeCompletionEvent) {
  // Notify application
  SslHandshakeCompletionEvent completion = (SslHandshakeCompletionEvent) evt;
  if (completion.isSuccess()) {
   // Remove from the pipeline after handshake result
   ctx.pipeline().remove(this);
   applicationProtocol = sslHandler.applicationProtocol();
   channelHandler.handle(io.vertx.core.Future.succeededFuture(channel));
  } else {
   SSLHandshakeException sslException = new SSLHandshakeException("Failed to create SSL connection");
   sslException.initCause(completion.cause());
   channelHandler.handle(io.vertx.core.Future.failedFuture(sslException));
  }
 }
 ctx.fireUserEventTriggered(evt);
}
@Override

代码示例来源:origin: io.netty/netty-handler

@Override
public void handle(long ssl, byte[] keyTypeBytes, byte[][] asn1DerEncodedPrincipals) throws Exception {
  final ReferenceCountedOpenSslEngine engine = engineMap.get(ssl);
  try {
    final Set<String> keyTypesSet = supportedClientKeyTypes(keyTypeBytes);
    final String[] keyTypes = keyTypesSet.toArray(new String[0]);
    final X500Principal[] issuers;
    if (asn1DerEncodedPrincipals == null) {
      issuers = null;
    } else {
      issuers = new X500Principal[asn1DerEncodedPrincipals.length];
      for (int i = 0; i < asn1DerEncodedPrincipals.length; i++) {
        issuers[i] = new X500Principal(asn1DerEncodedPrincipals[i]);
      }
    }
    keyManagerHolder.setKeyMaterialClientSide(engine, keyTypes, issuers);
  } catch (Throwable cause) {
    logger.debug("request of key failed", cause);
    SSLHandshakeException e = new SSLHandshakeException("General OpenSslEngine problem");
    e.initCause(cause);
    engine.handshakeException = e;
  }
}

代码示例来源:origin: io.netty/netty-handler

@Override
  public void handle(long ssl, byte[] keyTypeBytes, byte[][] asn1DerEncodedPrincipals) throws Exception {
    final ReferenceCountedOpenSslEngine engine = engineMap.get(ssl);
    try {
      // For now we just ignore the asn1DerEncodedPrincipals as this is kind of inline with what the
      // OpenJDK SSLEngineImpl does.
      keyManagerHolder.setKeyMaterialServerSide(engine);
    } catch (Throwable cause) {
      logger.debug("Failed to set the server-side key material", cause);
      SSLHandshakeException e = new SSLHandshakeException("General OpenSslEngine problem");
      e.initCause(cause);
      engine.handshakeException = e;
    }
  }
}

代码示例来源:origin: io.netty/netty-handler

logger.debug("verification of certificate failed", cause);
SSLHandshakeException e = new SSLHandshakeException("General OpenSslEngine problem");
e.initCause(cause);
engine.handshakeException = e;

代码示例来源:origin: org.conscrypt/conscrypt-openjdk-uber

/**
 * Wraps the given exception if it's not already a {@link SSLHandshakeException}.
 */
static SSLHandshakeException toSSLHandshakeException(Throwable e) {
  if (e instanceof SSLHandshakeException) {
    return (SSLHandshakeException) e;
  }
  return (SSLHandshakeException) new SSLHandshakeException(e.getMessage()).initCause(e);
}

代码示例来源:origin: org.apache.activemq/artemis-jms-client-all

/**
 * Converts the given exception to a {@link SSLHandshakeException}, if it isn't already.
 */
static SSLHandshakeException toSSLHandshakeException(Throwable e) {
  if (e instanceof SSLHandshakeException) {
    return (SSLHandshakeException) e;
  }
  return (SSLHandshakeException) new SSLHandshakeException(e.getMessage()).initCause(e);
}

代码示例来源:origin: apache/activemq-artemis

/**
 * Converts the given exception to a {@link SSLHandshakeException}, if it isn't already.
 */
static SSLHandshakeException toSSLHandshakeException(Throwable e) {
  if (e instanceof SSLHandshakeException) {
    return (SSLHandshakeException) e;
  }
  return (SSLHandshakeException) new SSLHandshakeException(e.getMessage()).initCause(e);
}

代码示例来源:origin: org.apache.ratis/ratis-proto-shaded

/**
 * Converts the given exception to a {@link SSLHandshakeException}, if it isn't already.
 */
static SSLHandshakeException toSSLHandshakeException(Throwable e) {
  if (e instanceof SSLHandshakeException) {
    return (SSLHandshakeException) e;
  }
  return (SSLHandshakeException) new SSLHandshakeException(e.getMessage()).initCause(e);
}

代码示例来源:origin: com.datastax.oss/java-driver-core-shaded

/**
 * Converts the given exception to a {@link SSLHandshakeException}, if it isn't already.
 */
static SSLHandshakeException toSSLHandshakeException(Throwable e) {
  if (e instanceof SSLHandshakeException) {
    return (SSLHandshakeException) e;
  }
  return (SSLHandshakeException) new SSLHandshakeException(e.getMessage()).initCause(e);
}

代码示例来源:origin: com.aliyun.openservices/ons-client

@Override
public String select(List<String> protocols) throws SSLException {
  try {
    return protocolSelector.select(protocols);
  } catch (SSLHandshakeException e) {
    throw e;
  } catch (Throwable t) {
    SSLHandshakeException e = new SSLHandshakeException(t.getMessage());
    e.initCause(t);
    throw e;
  }
}

代码示例来源:origin: com.aliyun.openservices/ons-client

@Override
public void selected(String protocol) throws SSLException {
  try {
    protocolListener.selected(protocol);
  } catch (SSLHandshakeException e) {
    throw e;
  } catch (Throwable t) {
    SSLHandshakeException e = new SSLHandshakeException(t.getMessage());
    e.initCause(t);
    throw e;
  }
}

相关文章