本文整理了Java中javax.net.ssl.SSLHandshakeException.<init>()
方法的一些代码示例,展示了SSLHandshakeException.<init>()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。SSLHandshakeException.<init>()
方法的具体详情如下:
包路径:javax.net.ssl.SSLHandshakeException
类名称:SSLHandshakeException
方法名:<init>
[英]Constructs a new instance with the given detail message.
[中]使用给定的详细信息构造一个新实例。
代码示例来源:origin: redisson/redisson
@Override
protected void noSelectedMatchFound(String protocol) throws Exception {
throw new SSLHandshakeException("No compatible protocols found");
}
}
代码示例来源:origin: apache/kafka
private SSLHandshakeException renegotiationException() {
return new SSLHandshakeException("Renegotiation is not supported");
}
代码示例来源:origin: redisson/redisson
@Override
public String noSelectMatchFound() throws Exception {
throw new SSLHandshakeException("Selected protocol is not supported");
}
}
代码示例来源:origin: wildfly/wildfly
@Override
public String noSelectMatchFound() throws Exception {
throw new SSLHandshakeException("Selected protocol is not supported");
}
}
代码示例来源:origin: wildfly/wildfly
@Override
protected void noSelectedMatchFound(String protocol) throws Exception {
throw new SSLHandshakeException("No compatible protocols found");
}
}
代码示例来源: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: 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
private SSLException shutdownWithError(String operation, int sslError, int error) {
String errorString = SSL.getErrorString(error);
if (logger.isDebugEnabled()) {
logger.debug("{} failed with {}: OpenSSL error: {} {}",
operation, sslError, error, errorString);
}
// There was an internal error -- shutdown
shutdown();
if (handshakeState == HandshakeState.FINISHED) {
return new SSLException(errorString);
}
return new SSLHandshakeException(errorString);
}
代码示例来源:origin: wildfly/wildfly
@Override
public final SSLHandshakeException noContextForSslConnection() {
final SSLHandshakeException result = new SSLHandshakeException(String.format(getLoggingLocale(), noContextForSslConnection$str()));
final StackTraceElement[] st = result.getStackTrace();
result.setStackTrace(Arrays.copyOfRange(st, 1, st.length));
return result;
}
private static final String sslClosed = "ELY04007: SSL channel is closed";
代码示例来源:origin: wildfly/wildfly
@Override
public final SSLHandshakeException invalidHandshakeRecord() {
final SSLHandshakeException result = new SSLHandshakeException(String.format(getLoggingLocale(), invalidHandshakeRecord$str()));
final StackTraceElement[] st = result.getStackTrace();
result.setStackTrace(Arrays.copyOfRange(st, 1, st.length));
return result;
}
private static final String multiRecordSSLHandshake = "UT000142: Initial SSL/TLS handshake spans multiple records";
代码示例来源:origin: wildfly/wildfly
@Override
public final SSLHandshakeException expectedServerHello() {
final SSLHandshakeException result = new SSLHandshakeException(String.format(getLoggingLocale(), expectedServerHello$str()));
final StackTraceElement[] st = result.getStackTrace();
result.setStackTrace(Arrays.copyOfRange(st, 1, st.length));
return result;
}
private static final String tooManyRedirects = "UT000145: Too many redirects";
代码示例来源:origin: redisson/redisson
private void rejectRemoteInitiatedRenegotiation() throws SSLHandshakeException {
// As rejectRemoteInitiatedRenegotiation() is called in a finally block we also need to check if we shutdown
// the engine before as otherwise SSL.getHandshakeCount(ssl) will throw an NPE if the passed in ssl is 0.
// See https://github.com/netty/netty/issues/7353
if (!isDestroyed() && SSL.getHandshakeCount(ssl) > 1 &&
// As we may count multiple handshakes when TLSv1.3 is used we should just ignore this here as
// renegotiation is not supported in TLSv1.3 as per spec.
!SslUtils.PROTOCOL_TLS_V1_3.equals(session.getProtocol()) && handshakeState == HandshakeState.FINISHED) {
// TODO: In future versions me may also want to send a fatal_alert to the client and so notify it
// that the renegotiation failed.
shutdown();
throw new SSLHandshakeException("remote-initiated renegotiation not allowed");
}
}
代码示例来源:origin: wildfly/wildfly
@Override
public final SSLHandshakeException invalidHandshakeRecord() {
final SSLHandshakeException result = new SSLHandshakeException(String.format(getLoggingLocale(), invalidHandshakeRecord$str()));
final StackTraceElement[] st = result.getStackTrace();
result.setStackTrace(Arrays.copyOfRange(st, 1, st.length));
return result;
}
private static final String multiRecordSSLHandshake = "ELY04010: Initial SSL/TLS handshake spans multiple records";
代码示例来源:origin: wildfly/wildfly
@Override
public final SSLHandshakeException multiRecordSSLHandshake() {
final SSLHandshakeException result = new SSLHandshakeException(String.format(getLoggingLocale(), multiRecordSSLHandshake$str()));
final StackTraceElement[] st = result.getStackTrace();
result.setStackTrace(Arrays.copyOfRange(st, 1, st.length));
return result;
}
private static final String expectedClientHello = "UT000143: Expected \"client hello\" record";
代码示例来源:origin: wildfly/wildfly
@Override
public final SSLHandshakeException expectedClientHello() {
final SSLHandshakeException result = new SSLHandshakeException(String.format(getLoggingLocale(), expectedClientHello$str()));
final StackTraceElement[] st = result.getStackTrace();
result.setStackTrace(Arrays.copyOfRange(st, 1, st.length));
return result;
}
private static final String unsupportedSslRecord = "ELY04012: Unsupported SSL/TLS record";
代码示例来源:origin: wildfly/wildfly
@Override
public final SSLHandshakeException notHandshakeRecord() {
final SSLHandshakeException result = new SSLHandshakeException(String.format(getLoggingLocale(), notHandshakeRecord$str()));
final StackTraceElement[] st = result.getStackTrace();
result.setStackTrace(Arrays.copyOfRange(st, 1, st.length));
return result;
}
private static final String invalidHandshakeRecord = "UT000141: Initial SSL/TLS handshake record is invalid";
代码示例来源:origin: wildfly/wildfly
@Override
public final SSLHandshakeException expectedClientHello() {
final SSLHandshakeException result = new SSLHandshakeException(String.format(getLoggingLocale(), expectedClientHello$str()));
final StackTraceElement[] st = result.getStackTrace();
result.setStackTrace(Arrays.copyOfRange(st, 1, st.length));
return result;
}
private static final String expectedServerHello = "UT000144: Expected server hello";
代码示例来源:origin: wildfly/wildfly
private void rejectRemoteInitiatedRenegotiation() throws SSLHandshakeException {
// As rejectRemoteInitiatedRenegotiation() is called in a finally block we also need to check if we shutdown
// the engine before as otherwise SSL.getHandshakeCount(ssl) will throw an NPE if the passed in ssl is 0.
// See https://github.com/netty/netty/issues/7353
if (!isDestroyed() && SSL.getHandshakeCount(ssl) > 1) {
// TODO: In future versions me may also want to send a fatal_alert to the client and so notify it
// that the renegotiation failed.
shutdown();
throw new SSLHandshakeException("remote-initiated renegotiation not allowed");
}
}
代码示例来源: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: redisson/redisson
private SSLEngineResult sslReadErrorResult(int error, int stackError, int bytesConsumed, int bytesProduced)
throws SSLException {
// Check if we have a pending handshakeException and if so see if we need to consume all pending data from the
// BIO first or can just shutdown and throw it now.
// This is needed so we ensure close_notify etc is correctly send to the remote peer.
// See https://github.com/netty/netty/issues/3900
if (SSL.bioLengthNonApplication(networkBIO) > 0) {
if (handshakeException == null && handshakeState != HandshakeState.FINISHED) {
// we seems to have data left that needs to be transferred and so the user needs
// call wrap(...). Store the error so we can pick it up later.
handshakeException = new SSLHandshakeException(SSL.getErrorString(stackError));
}
// We need to clear all errors so we not pick up anything that was left on the stack on the next
// operation. Note that shutdownWithError(...) will cleanup the stack as well so its only needed here.
SSL.clearError();
return new SSLEngineResult(OK, NEED_WRAP, bytesConsumed, bytesProduced);
}
throw shutdownWithError("SSL_read", error, stackError);
}
内容来源于网络,如有侵权,请联系作者删除!