@SuppressWarnings("MissingOverride") // For compilation with Java 6. public final SSLSession getHandshakeSession() { return handshakeSession(); }
/** * Sets an application-provided ALPN protocol selector. If provided, this will override * the list of protocols set by {@link #setApplicationProtocols(SSLEngine, String[])}. * * @param engine the engine * @param selector the ALPN protocol selector */ public static void setApplicationProtocolSelector(SSLEngine engine, ApplicationProtocolSelector selector) { toConscrypt(engine).setApplicationProtocolSelector(selector); }
/** * Gets the application-layer protocols (ALPN) in prioritization order. * * @param engine the engine * @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(SSLEngine engine) { return toConscrypt(engine).getApplicationProtocols(); }
/** * Returns the maximum overhead, in bytes, of sealing a record with SSL. */ public static int maxSealOverhead(SSLEngine engine) { return toConscrypt(engine).maxSealOverhead(); }
/** * Returns either the hostname supplied during socket creation or via * {@link #setHostname(SSLEngine, String)}. No DNS resolution is attempted before * returning the hostname. */ public static String getHostname(SSLEngine engine) { return toConscrypt(engine).getHostname(); }
@Override public SSLParameters getSSLParameters() { SSLParameters params = super.getSSLParameters(); Platform.getSSLParameters(params, sslParameters, this); return params; }
/** * Returns the tls-unique channel binding value for this connection, per RFC 5929. This * will return {@code null} if there is no such value available, such as if the handshake * has not yet completed or this connection is closed. */ public static byte[] getTlsUnique(SSLEngine engine) { return toConscrypt(engine).getTlsUnique(); }
/** * Returns the ALPN protocol agreed upon by client and server. * * @param engine the engine * @return the selected protocol or {@code null} if no protocol was agreed upon. */ public static String getApplicationProtocol(SSLEngine engine) { return toConscrypt(engine).getApplicationProtocol(); }
/** * Gets the TLS Channel ID for the given server-side engine. Channel ID is only available * once the handshake completes. * * @param engine the engine * @return channel ID or {@code null} if not available. * @throws IllegalStateException if this is a client engine or if the handshake has not yet * completed. * @throws SSLException if channel ID is available but could not be obtained. */ public static byte[] getChannelId(SSLEngine engine) throws SSLException { return toConscrypt(engine).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(SSLEngine engine, String label, byte[] context, int length) throws SSLException { return toConscrypt(engine).exportKeyingMaterial(label, context, length); } }
/** * Sets an application-provided ALPN protocol selector. If provided, this will override * the list of protocols set by {@link #setApplicationProtocols(SSLEngine, String[])}. * * @param engine the engine * @param selector the ALPN protocol selector */ public static void setApplicationProtocolSelector(SSLEngine engine, ApplicationProtocolSelector selector) { toConscrypt(engine).setApplicationProtocolSelector(selector); }
/** * Gets the application-layer protocols (ALPN) in prioritization order. * * @param engine the engine * @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(SSLEngine engine) { return toConscrypt(engine).getApplicationProtocols(); }
/** * Returns the maximum overhead, in bytes, of sealing a record with SSL. */ public static int maxSealOverhead(SSLEngine engine) { return toConscrypt(engine).maxSealOverhead(); }
/** * Returns either the hostname supplied during socket creation or via * {@link #setHostname(SSLEngine, String)}. No DNS resolution is attempted before * returning the hostname. */ public static String getHostname(SSLEngine engine) { return toConscrypt(engine).getHostname(); }
@Override public SSLParameters getSSLParameters() { SSLParameters params = super.getSSLParameters(); Platform.getSSLParameters(params, sslParameters, this); return params; }
/** * Returns the tls-unique channel binding value for this connection, per RFC 5929. This * will return {@code null} if there is no such value available, such as if the handshake * has not yet completed or this connection is closed. */ public static byte[] getTlsUnique(SSLEngine engine) { return toConscrypt(engine).getTlsUnique(); }
/** * Returns the ALPN protocol agreed upon by client and server. * * @param engine the engine * @return the selected protocol or {@code null} if no protocol was agreed upon. */ public static String getApplicationProtocol(SSLEngine engine) { return toConscrypt(engine).getApplicationProtocol(); }
/** * Gets the TLS Channel ID for the given server-side engine. Channel ID is only available * once the handshake completes. * * @param engine the engine * @return channel ID or {@code null} if not available. * @throws IllegalStateException if this is a client engine or if the handshake has not yet * completed. * @throws SSLException if channel ID is available but could not be obtained. */ public static byte[] getChannelId(SSLEngine engine) throws SSLException { return toConscrypt(engine).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(SSLEngine engine, String label, byte[] context, int length) throws SSLException { return toConscrypt(engine).exportKeyingMaterial(label, context, length); } }
@SuppressWarnings("MissingOverride") // For compilation with Java 6. public final SSLSession getHandshakeSession() { return handshakeSession(); }