SSLHandshakeException
Code IndexAdd Codota to your IDE (free)

Best code snippets using javax.net.ssl.SSLHandshakeException(Showing top 20 results out of 531)

Refine search

  • SSLException
  • SSLEngineResult
  • X500Principal
  • SSLSession
  • Common ways to obtain SSLHandshakeException
private void myMethod () {
SSLHandshakeException s =
  • new SSLHandshakeException("Client certificate requested for " + "kerberos cipher suite.")
  • new SSLHandshakeException("Client authentication requested for " + "anonymous cipher suite.")
  • String reason;new SSLHandshakeException(reason)
  • AI code suggestions by Codota
}
origin: redisson/redisson

private SSLException shutdownWithError(String operation, String err) {
  if (logger.isDebugEnabled()) {
    logger.debug("{} failed: OpenSSL error: {}", operation, err);
  }
  // There was an internal error -- shutdown
  shutdown();
  if (handshakeState == HandshakeState.FINISHED) {
    return new SSLException(err);
  }
  return new SSLHandshakeException(err);
}
origin: redisson/redisson

private SSLEngineResult sslReadErrorResult(int err, int bytesConsumed, int bytesProduced) throws SSLException {
  String errStr = SSL.getErrorString(err);
  // 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 transfered and so the user needs
      // call wrap(...). Store the error so we can pick it up later.
      handshakeException = new SSLHandshakeException(errStr);
    }
    return new SSLEngineResult(OK, NEED_WRAP, bytesConsumed, bytesProduced);
  }
  throw shutdownWithError("SSL_read", errStr);
}
origin: redisson/redisson

@Override
public KeyMaterial requested(long ssl, byte[] keyTypeBytes, byte[][] asn1DerEncodedPrincipals) {
  final ReferenceCountedOpenSslEngine engine = engineMap.get(ssl);
  try {
    final Set<String> keyTypesSet = supportedClientKeyTypes(keyTypeBytes);
    final String[] keyTypes = keyTypesSet.toArray(new String[keyTypesSet.size()]);
    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]);
      }
    }
    return keyManagerHolder.keyMaterial(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;
    return null;
  }
}
origin: org.apache.httpcomponents/httpclient

throw new SSLHandshakeException("SSL session not available");
this.log.debug(" negotiated protocol: " + session.getProtocol());
this.log.debug(" negotiated cipher suite: " + session.getCipherSuite());
  final Certificate[] certs = session.getPeerCertificates();
  final X509Certificate x509 = (X509Certificate) certs[0];
  final X500Principal peer = x509.getSubjectX500Principal();
  this.log.debug(" peer principal: " + peer.toString());
  final Collection<List<?>> altNames1 = x509.getSubjectAlternativeNames();
  if (altNames1 != null) {
  this.log.debug(" issuer principal: " + issuer.toString());
  final Collection<List<?>> altNames2 = x509.getIssuerAlternativeNames();
  if (altNames2 != null) {
origin: intuit/wasabi

private SSLException shutdownWithError(String operation, String err) {
  if (logger.isDebugEnabled()) {
    logger.debug("{} failed: OpenSSL error: {}", operation, err);
  }
  // There was an internal error -- shutdown
  shutdown();
  if (handshakeState == HandshakeState.FINISHED) {
    return new SSLException(err);
  }
  return new SSLHandshakeException(err);
}
origin: stackoverflow.com

 // Open SSLSocket directly to gmail.com
SocketFactory sf = SSLSocketFactory.getDefault();
SSLSocket socket = (SSLSocket) sf.createSocket("gmail.com", 443);
HostnameVerifier hv = HttpsURLConnection.getDefaultHostnameVerifier();
SSLSession s = socket.getSession();

// Verify that the certicate hostname is for mail.google.com
// This is due to lack of SNI support in the current SSLSocket.
if (!hv.verify("mail.google.com", s)) {
  throw new SSLHandshakeException("Expected mail.google.com, "
                  "found " + s.getPeerPrincipal());
}

// At this point SSLSocket performed certificate verificaiton and
// we have performed hostname verification, so it is safe to proceed.

// ... use socket ...
socket.close();
origin: KostyaSha/yet-another-docker-plugin

private SSLException shutdownWithError(String operation, String err) {
  if (logger.isDebugEnabled()) {
    logger.debug("{} failed: OpenSSL error: {}", operation, err);
  }
  // There was an internal error -- shutdown
  shutdown();
  if (handshakeState == HandshakeState.FINISHED) {
    return new SSLException(err);
  }
  return new SSLHandshakeException(err);
}
origin: com.aliyun.openservices/ons-client

@Override
public KeyMaterial requested(long ssl, byte[] keyTypeBytes, byte[][] asn1DerEncodedPrincipals) {
  final ReferenceCountedOpenSslEngine engine = engineMap.get(ssl);
  try {
    final Set<String> keyTypesSet = supportedClientKeyTypes(keyTypeBytes);
    final String[] keyTypes = keyTypesSet.toArray(new String[keyTypesSet.size()]);
    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]);
      }
    }
    return keyManagerHolder.keyMaterial(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;
    return null;
  }
}
origin: org.apache.hbase.thirdparty/hbase-shaded-netty

private SSLEngineResult sslReadErrorResult(int err, int bytesConsumed, int bytesProduced) throws SSLException {
  String errStr = SSL.getErrorString(err);
  // 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 transfered and so the user needs
      // call wrap(...). Store the error so we can pick it up later.
      handshakeException = new SSLHandshakeException(errStr);
    }
    return new SSLEngineResult(OK, NEED_WRAP, bytesConsumed, bytesProduced);
  }
  throw shutdownWithError("SSL_read", errStr);
}
origin: com.couchbase.client/core-io

@Override
public KeyMaterial requested(long ssl, byte[] keyTypeBytes, byte[][] asn1DerEncodedPrincipals) {
  final ReferenceCountedOpenSslEngine engine = engineMap.get(ssl);
  try {
    final Set<String> keyTypesSet = supportedClientKeyTypes(keyTypeBytes);
    final String[] keyTypes = keyTypesSet.toArray(new String[keyTypesSet.size()]);
    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]);
      }
    }
    return keyManagerHolder.keyMaterial(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;
    return null;
  }
}
origin: apache/nifi

final ByteBuffer appDataBuffer = appDataManager.prepareForWrite(engine.getSession().getApplicationBufferSize());
unwrapResponse = engine.unwrap(streamInBuffer, appDataBuffer);
logger.trace("{} When reading data, (handshake={}) Unwrap response: {}", this, handshaking, unwrapResponse);
switch (unwrapResponse.getStatus()) {
  case BUFFER_OVERFLOW:
    throw new SSLHandshakeException("Buffer Overflow, which is not allowed to happen from an unwrap");
  case BUFFER_UNDERFLOW: {
    final ByteBuffer writableInBuffer = streamInManager.prepareForWrite(engine.getSession().getPacketBufferSize());
    final int bytesRead = readData(writableInBuffer);
    if (bytesRead < 0) {
origin: com.aliyun.openservices/ons-client

private SSLException shutdownWithError(String operation, String err) {
  if (logger.isDebugEnabled()) {
    logger.debug("{} failed: OpenSSL error: {}", operation, err);
  }
  // There was an internal error -- shutdown
  shutdown();
  if (handshakeState == HandshakeState.FINISHED) {
    return new SSLException(err);
  }
  return new SSLHandshakeException(err);
}
origin: apache/nifi

  final ByteBuffer appDataOut = ByteBuffer.wrap(emptyMessage);
  final ByteBuffer outboundBuffer = streamOutManager.prepareForWrite(engine.getSession().getApplicationBufferSize());
  if (wrapHelloResult.getStatus() == Status.BUFFER_OVERFLOW) {
    streamOutManager.prepareForWrite(engine.getSession().getApplicationBufferSize());
    continue;
  if (wrapHelloResult.getStatus() != Status.OK) {
    throw new SSLHandshakeException("Could not generate SSL Handshake information: SSLEngineResult: "
        + wrapHelloResult.toString());
case NEED_UNWRAP: {
  final ByteBuffer readableDataIn = streamInManager.prepareForRead(0);
  final ByteBuffer appData = appDataManager.prepareForWrite(engine.getSession().getApplicationBufferSize());
      throw new SSLHandshakeException("Reached End-of-File marker while performing handshake");
  } else if (handshakeResponseResult.getStatus() == Status.CLOSED) {
origin: org.glassfish.tyrus.bundles/tyrus-standalone-client

sslEngine.getSession().invalidate();
  if (e.toString().toLowerCase().contains("insecure renegotiation")) {
    if (LOGGER.isLoggable(Level.SEVERE)) {
      LOGGER.severe("Secure SSL/TLS renegotiation is not "
origin: apache/activemq-artemis

private SSLEngineResult sslReadErrorResult(int err, int bytesConsumed, int bytesProduced) throws SSLException {
  String errStr = SSL.getErrorString(err);
  // 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 transfered and so the user needs
      // call wrap(...). Store the error so we can pick it up later.
      handshakeException = new SSLHandshakeException(errStr);
    }
    return new SSLEngineResult(OK, NEED_WRAP, bytesConsumed, bytesProduced);
  }
  throw shutdownWithError("SSL_read", errStr);
}
origin: com.couchbase.client/core-io

private SSLException shutdownWithError(String operation, String err) {
  if (logger.isDebugEnabled()) {
    logger.debug("{} failed: OpenSSL error: {}", operation, err);
  }
  // There was an internal error -- shutdown
  shutdown();
  if (handshakeState == HandshakeState.FINISHED) {
    return new SSLException(err);
  }
  return new SSLHandshakeException(err);
}
origin: pingcap/tispark

private SSLEngineResult sslReadErrorResult(int err, int bytesConsumed, int bytesProduced) throws SSLException {
  String errStr = SSL.getErrorString(err);
  // 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 transfered and so the user needs
      // call wrap(...). Store the error so we can pick it up later.
      handshakeException = new SSLHandshakeException(errStr);
    }
    return new SSLEngineResult(OK, NEED_WRAP, bytesConsumed, bytesProduced);
  }
  throw shutdownWithError("SSL_read", errStr);
}
origin: apache/activemq-artemis

@Override
public KeyMaterial requested(long ssl, byte[] keyTypeBytes, byte[][] asn1DerEncodedPrincipals) {
  final ReferenceCountedOpenSslEngine engine = engineMap.get(ssl);
  try {
    final Set<String> keyTypesSet = supportedClientKeyTypes(keyTypeBytes);
    final String[] keyTypes = keyTypesSet.toArray(new String[keyTypesSet.size()]);
    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]);
      }
    }
    return keyManagerHolder.keyMaterial(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;
    return null;
  }
}
origin: apache/activemq-artemis

private SSLException shutdownWithError(String operation, String err) {
  if (logger.isDebugEnabled()) {
    logger.debug("{} failed: OpenSSL error: {}", operation, err);
  }
  // There was an internal error -- shutdown
  shutdown();
  if (handshakeState == HandshakeState.FINISHED) {
    return new SSLException(err);
  }
  return new SSLHandshakeException(err);
}
origin: intuit/wasabi

private SSLEngineResult sslReadErrorResult(int err, int bytesConsumed, int bytesProduced) throws SSLException {
  String errStr = SSL.getErrorString(err);
  // 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.pendingWrittenBytesInBIO(networkBIO) > 0) {
    if (handshakeException == null && handshakeState != HandshakeState.FINISHED) {
      // we seems to have data left that needs to be transfered and so the user needs
      // call wrap(...). Store the error so we can pick it up later.
      handshakeException = new SSLHandshakeException(errStr);
    }
    return new SSLEngineResult(OK, NEED_WRAP, bytesConsumed, bytesProduced);
  }
  throw shutdownWithError("SSL_read", errStr);
}
javax.net.sslSSLHandshakeException

Javadoc

The exception that is thrown when a handshake could not be completed successfully.

Most used methods

  • <init>
    Constructs a new instance with given cause.
  • initCause
  • getMessage
  • toString
  • getStackTrace
  • setStackTrace
  • getCause
  • getLocalizedMessage

Popular classes and methods

  • scheduleAtFixedRate (Timer)
    Schedules the specified task for repeated fixed-rate execution, beginning after the specified delay.
  • getContentResolver (Context)
  • setRequestProperty (URLConnection)
    Sets the value of the specified request header field. The value will only be used by the current URL
  • HttpURLConnection (java.net)
    An URLConnection for HTTP (RFC 2616 [http://tools.ietf.org/html/rfc2616]) used to send and receive d
  • Proxy (java.net)
    This class represents a proxy setting, typically a type (http, socks) and a socket address. A Proxy
  • Selector (java.nio.channels)
    A controller for the selection of SelectableChannel objects. Selectable channels can be registered w
  • GregorianCalendar (java.util)
    GregorianCalendar is a concrete subclass of Calendarand provides the standard calendar used by most
  • Properties (java.util)
    The Properties class represents a persistent set of properties. The Properties can be saved to a st
  • ExecutorService (java.util.concurrent)
    An Executor that provides methods to manage termination and methods that can produce a Future for tr
  • JarFile (java.util.jar)
    JarFile is used to read jar entries and their associated data from jar files.

For IntelliJ IDEA and
Android Studio

  • Codota IntelliJ IDEA pluginCodota Android Studio pluginCode IndexSign in
  • EnterpriseFAQAboutContact Us
  • Terms of usePrivacy policyCodeboxFind Usages
Add Codota to your IDE (free)