SSLUtils

Utility methods for SSL packet processing. Copied from the Netty project. <p> This is a public class to allow testing to occur on Android via CTS.

Members

Enums

SessionType
enum SessionType
Undocumented in source.

Static functions

calculateOutNetBufSize
int calculateOutNetBufSize(int pendingBytes)

Calculates the minimum bytes required in the encrypted output buffer for the given number of plaintext source bytes.

decodeProtocols
string[] decodeProtocols(ubyte[] protocols)

Decodes the given list of protocols into {@link string}s. @param protocols the encoded protocol list @return the decoded protocols or {@link EmptyArray#BYTE} if {@code protocols} is empty. @throws NullPointerException if protocols is {@code null}.

encodeProtocols
byte[] encodeProtocols(string[] protocols)

Encodes a list of protocols into the wire-format (length-prefixed 8-bit strings). Requires that all strings be encoded with US-ASCII.

getEncryptedPacketLength
int getEncryptedPacketLength(ByteBuffer[] buffers, int offset)

Return how much bytes can be read out of the encrypted data. Be aware that this method will not increase the readerIndex of the given {@link ByteBuffer}.

getServerX509KeyType
string getServerX509KeyType(long sslCipherNative)

Returns key type constant suitable for calling X509KeyManager.chooseServerAlias or X509ExtendedKeyManager.chooseEngineServerAlias. Returns {@code null} for key exchanges that do not use X.509 for server authentication.

isSupportedType
bool isSupportedType(int type)
Undocumented in source. Be warned that the author may not have intended to support it.
toProtocolBytes
byte[] toProtocolBytes(string protocol)
Undocumented in source. Be warned that the author may not have intended to support it.
toProtocolString
string toProtocolString(byte[] bytes)
Undocumented in source. Be warned that the author may not have intended to support it.
toSSLException
SSLException toSSLException(Throwable e)

Wraps the given exception if it's not already a {@link SSLException}.

toSSLHandshakeException
SSLHandshakeException toSSLHandshakeException(Throwable e)

Wraps the given exception if it's not already a {@link SSLHandshakeException}.

Variables

USE_ENGINE_SOCKET_BY_DEFAULT
enum bool USE_ENGINE_SOCKET_BY_DEFAULT;
Undocumented in source.

Meta