@Override public final void connect(SocketAddress endpoint) throws IOException { connect(endpoint, 0); }
@Override public FileDescriptor getFileDescriptor$() { return super.getFileDescriptor$(); }
@Override String getHostname() { return AbstractConscryptSocket.this.getHostname(); }
@Override public String getHostnameOrIP() { return super.getHostnameOrIP(); }
/** * Returns the ALPN protocol agreed upon by client and server. * * @param socket the socket * @return the selected protocol or {@code null} if no protocol was agreed upon. */ public static String getApplicationProtocol(SSLSocket socket) { return toConscrypt(socket).getApplicationProtocol(); }
/** * Gets the application-layer protocols (ALPN) in prioritization order. * * @param socket the socket * @return the protocols in descending order of preference, or an empty array if protocol * indications are not being used. Always returns a new array. */ public static String[] getApplicationProtocols(SSLSocket socket) { return toConscrypt(socket).getApplicationProtocols(); }
/** * Gets the TLS Channel ID for the given server-side socket. Channel ID is only available * once the handshake completes. * * @param socket the socket * @return channel ID or {@code null} if not available. * @throws IllegalStateException if this is a client socket or if the handshake has not yet * completed. * @throws SSLException if channel ID is available but could not be obtained. */ public static byte[] getChannelId(SSLSocket socket) throws SSLException { return toConscrypt(socket).getChannelId(); }
/** * Exports a value derived from the TLS master secret as described in RFC 5705. * * @param label the label to use in calculating the exported value. This must be * an ASCII-only string. * @param context the application-specific context value to use in calculating the * exported value. This may be {@code null} to use no application context, which is * treated differently than an empty byte array. * @param length the number of bytes of keying material to return. * @return a value of the specified length, or {@code null} if the handshake has not yet * completed or the connection has been closed. * @throws SSLException if the value could not be exported. */ public static byte[] exportKeyingMaterial(SSLSocket socket, String label, byte[] context, int length) throws SSLException { return toConscrypt(socket).exportKeyingMaterial(label, context, length); }
/** * For the purposes of an SSLSession, we want a way to represent the supplied hostname * or the IP address in a textual representation. We do not want to perform reverse DNS * lookups on this address. */ String getHostnameOrIP() { if (peerHostname != null) { return peerHostname; } InetAddress peerAddress = getInetAddress(); if (peerAddress != null) { return Platform.getOriginalHostNameFromInetAddress(peerAddress); } return null; }
final void notifyHandshakeCompletedListeners() { if (listeners != null && !listeners.isEmpty()) { // notify the listeners HandshakeCompletedEvent event = new HandshakeCompletedEvent(this, getActiveSession()); for (HandshakeCompletedListener listener : listeners) { try { listener.handshakeCompleted(event); } catch (RuntimeException e) { // The RI runs the handlers in a separate thread, // which we do not. But we try to preserve their // behavior of logging a problem and not killing // the handshaking thread just because a listener // has a problem. Thread thread = Thread.currentThread(); thread.getUncaughtExceptionHandler().uncaughtException(thread, e); } } } }
@Override String getHostnameOrIP() { return AbstractConscryptSocket.this.getHostnameOrIP(); }
/** * Returns the ALPN protocol agreed upon by client and server. * * @param socket the socket * @return the selected protocol or {@code null} if no protocol was agreed upon. */ public static String getApplicationProtocol(SSLSocket socket) { return toConscrypt(socket).getApplicationProtocol(); }
/** * Gets the application-layer protocols (ALPN) in prioritization order. * * @param socket the socket * @return the protocols in descending order of preference, or an empty array if protocol * indications are not being used. Always returns a new array. */ public static String[] getApplicationProtocols(SSLSocket socket) { return toConscrypt(socket).getApplicationProtocols(); }
/** * Gets the TLS Channel ID for the given server-side socket. Channel ID is only available * once the handshake completes. * * @param socket the socket * @return channel ID or {@code null} if not available. * @throws IllegalStateException if this is a client socket or if the handshake has not yet * completed. * @throws SSLException if channel ID is available but could not be obtained. */ public static byte[] getChannelId(SSLSocket socket) throws SSLException { return toConscrypt(socket).getChannelId(); }
/** * Exports a value derived from the TLS master secret as described in RFC 5705. * * @param label the label to use in calculating the exported value. This must be * an ASCII-only string. * @param context the application-specific context value to use in calculating the * exported value. This may be {@code null} to use no application context, which is * treated differently than an empty byte array. * @param length the number of bytes of keying material to return. * @return a value of the specified length, or {@code null} if the handshake has not yet * completed or the connection has been closed. * @throws SSLException if the value could not be exported. */ public static byte[] exportKeyingMaterial(SSLSocket socket, String label, byte[] context, int length) throws SSLException { return toConscrypt(socket).exportKeyingMaterial(label, context, length); }
/** * For the purposes of an SSLSession, we want a way to represent the supplied hostname * or the IP address in a textual representation. We do not want to perform reverse DNS * lookups on this address. */ String getHostnameOrIP() { if (peerHostname != null) { return peerHostname; } InetAddress peerAddress = getInetAddress(); if (peerAddress != null) { return Platform.getOriginalHostNameFromInetAddress(peerAddress); } return null; }
final void notifyHandshakeCompletedListeners() { if (listeners != null && !listeners.isEmpty()) { // notify the listeners HandshakeCompletedEvent event = new HandshakeCompletedEvent(this, getActiveSession()); for (HandshakeCompletedListener listener : listeners) { try { listener.handshakeCompleted(event); } catch (RuntimeException e) { // The RI runs the handlers in a separate thread, // which we do not. But we try to preserve their // behavior of logging a problem and not killing // the handshaking thread just because a listener // has a problem. Thread thread = Thread.currentThread(); thread.getUncaughtExceptionHandler().uncaughtException(thread, e); } } } }
@Override public String getHostname() { return super.getHostname(); }
@Override String getHostnameOrIP() { return AbstractConscryptSocket.this.getHostnameOrIP(); }
@Override public FileDescriptor getFileDescriptor$() { return super.getFileDescriptor$(); }