public abstract class TlsProtocol extends Object
Constructor and Description |
---|
TlsProtocol(InputStream input,
OutputStream output,
SecureRandom secureRandom) |
Modifier and Type | Method and Description |
---|---|
protected int |
applicationDataAvailable() |
protected static void |
assertEmpty(ByteArrayInputStream buf)
Make sure the InputStream 'buf' now empty.
|
protected void |
cleanupHandshake() |
void |
close()
Closes this connection.
|
protected void |
completeHandshake() |
protected static byte[] |
createRandomBlock(boolean useGMTUnixTime,
RandomGenerator randomGenerator) |
protected static byte[] |
createRenegotiationInfo(byte[] renegotiated_connection) |
protected byte[] |
createVerifyData(boolean isServer) |
protected static void |
establishMasterSecret(TlsContext context,
TlsKeyExchange keyExchange) |
protected void |
failWithError(short alertLevel,
short alertDescription,
String message,
Throwable cause)
Terminate this connection with an alert.
|
protected void |
flush() |
protected abstract TlsContext |
getContext() |
protected static byte[] |
getCurrentPRFHash(TlsContext context,
TlsHandshakeHash handshakeHash,
byte[] sslSender)
'sender' only relevant to SSLv3
|
InputStream |
getInputStream() |
OutputStream |
getOutputStream() |
protected abstract TlsPeer |
getPeer() |
protected static int |
getPRFAlgorithm(TlsContext context,
int ciphersuite) |
protected void |
handleChangeCipherSpecMessage() |
protected void |
handleClose(boolean user_canceled) |
protected abstract void |
handleHandshakeMessage(short type,
byte[] buf) |
protected void |
handleWarningMessage(short description) |
protected void |
invalidateSession() |
protected boolean |
isClosed() |
protected void |
processFinishedMessage(ByteArrayInputStream buf) |
protected short |
processMaxFragmentLengthExtension(Hashtable clientExtensions,
Hashtable serverExtensions,
short alertDescription) |
protected void |
processRecord(short protocol,
byte[] buf,
int offset,
int len) |
protected void |
raiseAlert(short alertLevel,
short alertDescription,
String message,
Throwable cause) |
protected void |
raiseWarning(short alertDescription,
String message) |
protected int |
readApplicationData(byte[] buf,
int offset,
int len)
Read data from the network.
|
protected static Hashtable |
readExtensions(ByteArrayInputStream input) |
protected static Vector |
readSupplementalDataMessage(ByteArrayInputStream input) |
protected void |
safeReadRecord() |
protected void |
safeWriteRecord(short type,
byte[] buf,
int offset,
int len) |
protected void |
sendCertificateMessage(Certificate certificate) |
protected void |
sendChangeCipherSpecMessage() |
protected void |
sendFinishedMessage() |
protected void |
sendSupplementalDataMessage(Vector supplementalData) |
protected void |
writeData(byte[] buf,
int offset,
int len)
Send some application data to the remote system.
|
protected static void |
writeExtensions(OutputStream output,
Hashtable extensions) |
protected void |
writeHandshakeMessage(byte[] buf,
int off,
int len) |
protected static void |
writeSupplementalData(OutputStream output,
Vector supplementalData) |
protected static final Integer EXT_RenegotiationInfo
protected static final Integer EXT_SessionTicket
protected static final short CS_START
protected static final short CS_CLIENT_HELLO
protected static final short CS_SERVER_HELLO
protected static final short CS_SERVER_SUPPLEMENTAL_DATA
protected static final short CS_SERVER_CERTIFICATE
protected static final short CS_CERTIFICATE_STATUS
protected static final short CS_SERVER_KEY_EXCHANGE
protected static final short CS_CERTIFICATE_REQUEST
protected static final short CS_SERVER_HELLO_DONE
protected static final short CS_CLIENT_SUPPLEMENTAL_DATA
protected static final short CS_CLIENT_CERTIFICATE
protected static final short CS_CLIENT_KEY_EXCHANGE
protected static final short CS_CERTIFICATE_VERIFY
protected static final short CS_CLIENT_FINISHED
protected static final short CS_SERVER_SESSION_TICKET
protected static final short CS_SERVER_FINISHED
protected static final short CS_END
protected SecureRandom secureRandom
protected TlsSession tlsSession
protected SessionParameters sessionParameters
protected SecurityParameters securityParameters
protected Certificate peerCertificate
protected int[] offeredCipherSuites
protected short[] offeredCompressionMethods
protected Hashtable clientExtensions
protected Hashtable serverExtensions
protected short connection_state
protected boolean resumedSession
protected boolean receivedChangeCipherSpec
protected boolean secure_renegotiation
protected boolean allowCertificateStatus
protected boolean expectSessionTicket
public TlsProtocol(InputStream input, OutputStream output, SecureRandom secureRandom)
protected abstract TlsContext getContext()
protected abstract TlsPeer getPeer()
protected void handleChangeCipherSpecMessage() throws IOException
IOException
protected abstract void handleHandshakeMessage(short type, byte[] buf) throws IOException
IOException
protected void handleWarningMessage(short description) throws IOException
IOException
protected void cleanupHandshake()
protected void completeHandshake() throws IOException
IOException
protected void processRecord(short protocol, byte[] buf, int offset, int len) throws IOException
IOException
protected int applicationDataAvailable() throws IOException
IOException
protected int readApplicationData(byte[] buf, int offset, int len) throws IOException
buf
- The buffer where the data will be copied to.offset
- The position where the data will be placed in the buffer.len
- The maximum number of bytes to read.IOException
- If something goes wrong during reading data.protected void safeReadRecord() throws IOException
IOException
protected void safeWriteRecord(short type, byte[] buf, int offset, int len) throws IOException
IOException
protected void writeData(byte[] buf, int offset, int len) throws IOException
The method will handle fragmentation internally.
buf
- The buffer with the data.offset
- The position in the buffer where the data is placed.len
- The length of the data.IOException
- If something goes wrong during sending.protected void writeHandshakeMessage(byte[] buf, int off, int len) throws IOException
IOException
public OutputStream getOutputStream()
public InputStream getInputStream()
protected void failWithError(short alertLevel, short alertDescription, String message, Throwable cause) throws IOException
alertLevel
- See AlertLevel
for values.alertDescription
- See AlertDescription
for values.IOException
- If alert was fatal.protected void invalidateSession()
protected void processFinishedMessage(ByteArrayInputStream buf) throws IOException
IOException
protected void raiseAlert(short alertLevel, short alertDescription, String message, Throwable cause) throws IOException
IOException
protected void raiseWarning(short alertDescription, String message) throws IOException
IOException
protected void sendCertificateMessage(Certificate certificate) throws IOException
IOException
protected void sendChangeCipherSpecMessage() throws IOException
IOException
protected void sendFinishedMessage() throws IOException
IOException
protected void sendSupplementalDataMessage(Vector supplementalData) throws IOException
IOException
protected byte[] createVerifyData(boolean isServer)
public void close() throws IOException
IOException
- If something goes wrong during closing.protected void handleClose(boolean user_canceled) throws IOException
IOException
protected void flush() throws IOException
IOException
protected boolean isClosed()
protected short processMaxFragmentLengthExtension(Hashtable clientExtensions, Hashtable serverExtensions, short alertDescription) throws IOException
IOException
protected static void assertEmpty(ByteArrayInputStream buf) throws IOException
buf
- The InputStream to check.IOException
- If 'buf' is not empty.protected static byte[] createRandomBlock(boolean useGMTUnixTime, RandomGenerator randomGenerator)
protected static byte[] createRenegotiationInfo(byte[] renegotiated_connection) throws IOException
IOException
protected static void establishMasterSecret(TlsContext context, TlsKeyExchange keyExchange) throws IOException
IOException
protected static byte[] getCurrentPRFHash(TlsContext context, TlsHandshakeHash handshakeHash, byte[] sslSender)
protected static Hashtable readExtensions(ByteArrayInputStream input) throws IOException
IOException
protected static Vector readSupplementalDataMessage(ByteArrayInputStream input) throws IOException
IOException
protected static void writeExtensions(OutputStream output, Hashtable extensions) throws IOException
IOException
protected static void writeSupplementalData(OutputStream output, Vector supplementalData) throws IOException
IOException
protected static int getPRFAlgorithm(TlsContext context, int ciphersuite) throws IOException
IOException
Copyright © 2016 BouncyCastle.org. All rights reserved.