Java Code Examples for javax.net.ssl.SSLEngine#getHandshakeSession()

The following examples show how to use javax.net.ssl.SSLEngine#getHandshakeSession() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: RootTrustManager.java    From android_9.0.0_r45 with Apache License 2.0 5 votes vote down vote up
@Override
public void checkServerTrusted(X509Certificate[] certs, String authType, SSLEngine engine)
        throws CertificateException {
    SSLSession session = engine.getHandshakeSession();
    if (session == null) {
        throw new CertificateException("Not in handshake; no session available");
    }
    String host = session.getPeerHost();
    NetworkSecurityConfig config = mConfig.getConfigForHostname(host);
    config.getTrustManager().checkServerTrusted(certs, authType, engine);
}
 
Example 2
Source File: TrustManagerExt.java    From servicecomb-java-chassis with Apache License 2.0 5 votes vote down vote up
@Override
public void checkClientTrusted(X509Certificate[] chain, String authType,
    SSLEngine engine) throws CertificateException {
  if (!option.isAuthPeer()) {
    return;
  }

  String ip = null;
  if (engine != null) {
    SSLSession session = engine.getHandshakeSession();
    ip = session.getPeerHost();
  }
  checkTrustedCustom(chain, ip);
  trustManager.checkClientTrusted(chain, authType, engine);
}
 
Example 3
Source File: TrustManagerExt.java    From servicecomb-java-chassis with Apache License 2.0 5 votes vote down vote up
@Override
public void checkServerTrusted(X509Certificate[] chain, String authType,
    SSLEngine engine) throws CertificateException {
  if (!option.isAuthPeer()) {
    return;
  }

  String ip = null;
  if (engine != null) {
    SSLSession session = engine.getHandshakeSession();
    ip = session.getPeerHost();
  }
  checkTrustedCustom(chain, ip);
  trustManager.checkServerTrusted(chain, authType, engine);
}
 
Example 4
Source File: JettyAlpnProvider.java    From lams with GNU General Public License v2.0 5 votes vote down vote up
@Override
public String getSelectedProtocol(SSLEngine engine) {
    SSLSession handshake = engine.getHandshakeSession();
    if (handshake != null) {
        return (String) handshake.getValue(PROTOCOL_KEY);
    }
    handshake = engine.getSession();
    if (handshake != null) {
        return (String) handshake.getValue(PROTOCOL_KEY);
    }
    return null;
}
 
Example 5
Source File: ClientX509ExtendedTrustManager.java    From light-4j with Apache License 2.0 4 votes vote down vote up
private void checkIdentity(SSLEngine engine, X509Certificate cert)  throws CertificateException{
	if (null!=engine) {
		SSLSession session = engine.getHandshakeSession();
		checkIdentity(session, cert);
	}
}