org.bouncycastle.crypto.tls
public class TlsProtocolHandler extends java.lang.Object
Modifier and Type | Field and Description |
---|---|
protected static short |
AL_fatal |
protected static short |
AL_warning |
protected static short |
AP_access_denied |
protected static short |
AP_bad_certificate |
protected static short |
AP_bad_record_mac |
protected static short |
AP_certificate_expired |
protected static short |
AP_certificate_revoked |
protected static short |
AP_certificate_unknown |
protected static short |
AP_close_notify |
protected static short |
AP_decode_error |
protected static short |
AP_decompression_failure |
protected static short |
AP_decrypt_error |
protected static short |
AP_decryption_failed |
protected static short |
AP_export_restriction |
protected static short |
AP_handshake_failure |
protected static short |
AP_illegal_parameter |
protected static short |
AP_insufficient_security |
protected static short |
AP_internal_error |
protected static short |
AP_no_renegotiation |
protected static short |
AP_protocol_version |
protected static short |
AP_record_overflow |
protected static short |
AP_unexpected_message |
protected static short |
AP_unknown_ca |
protected static short |
AP_unsupported_certificate |
protected static short |
AP_user_canceled |
Constructor and Description |
---|
TlsProtocolHandler(java.io.InputStream is,
java.io.OutputStream os) |
TlsProtocolHandler(java.io.InputStream is,
java.io.OutputStream os,
java.security.SecureRandom sr) |
Modifier and Type | Method and Description |
---|---|
protected void |
assertEmpty(java.io.ByteArrayInputStream is)
Make sure the InputStream is now empty.
|
void |
close()
Closes this connection.
|
void |
connect(CertificateVerifyer verifyer)
Connects to the remote system.
|
protected void |
failWithError(short alertLevel,
short alertDescription)
Terminate this connection with an alert.
|
protected void |
flush() |
java.io.InputStream |
getInputStream() |
java.io.OutputStream |
getOutputStream() |
TlsInputStream |
getTlsInputStream()
Deprecated.
use 'getInputStream' instead
|
TlsOuputStream |
getTlsOuputStream()
Deprecated.
use 'getOutputStream' instead
|
protected void |
processData(short protocol,
byte[] buf,
int offset,
int len) |
protected int |
readApplicationData(byte[] buf,
int offset,
int len)
Read data from the network.
|
protected void |
writeData(byte[] buf,
int offset,
int len)
Send some application data to the remote system.
|
protected static final short AP_close_notify
protected static final short AP_unexpected_message
protected static final short AP_bad_record_mac
protected static final short AP_decryption_failed
protected static final short AP_record_overflow
protected static final short AP_decompression_failure
protected static final short AP_handshake_failure
protected static final short AP_bad_certificate
protected static final short AP_unsupported_certificate
protected static final short AP_certificate_revoked
protected static final short AP_certificate_expired
protected static final short AP_certificate_unknown
protected static final short AP_illegal_parameter
protected static final short AP_unknown_ca
protected static final short AP_access_denied
protected static final short AP_decode_error
protected static final short AP_decrypt_error
protected static final short AP_export_restriction
protected static final short AP_protocol_version
protected static final short AP_insufficient_security
protected static final short AP_internal_error
protected static final short AP_user_canceled
protected static final short AP_no_renegotiation
protected static final short AL_warning
protected static final short AL_fatal
public TlsProtocolHandler(java.io.InputStream is, java.io.OutputStream os)
public TlsProtocolHandler(java.io.InputStream is, java.io.OutputStream os, java.security.SecureRandom sr)
protected void processData(short protocol, byte[] buf, int offset, int len) throws java.io.IOException
java.io.IOException
public void connect(CertificateVerifyer verifyer) throws java.io.IOException
verifyer
- Will be used when a certificate is received to verify
that this certificate is accepted by the client.java.io.IOException
- If handshake was not successful.protected int readApplicationData(byte[] buf, int offset, int len) throws java.io.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.java.io.IOException
- If something goes wrong during reading data.protected void writeData(byte[] buf, int offset, int len) throws java.io.IOException
buf
- The buffer with the data.offset
- The position in the buffer where the data is placed.len
- The length of the data.java.io.IOException
- If something goes wrong during sending.public TlsOuputStream getTlsOuputStream()
public java.io.OutputStream getOutputStream()
public TlsInputStream getTlsInputStream()
public java.io.InputStream getInputStream()
protected void failWithError(short alertLevel, short alertDescription) throws java.io.IOException
alertLevel
- The level of the alert, an be AL_fatal or AL_warning.alertDescription
- The exact alert message.java.io.IOException
- If alert was fatal.public void close() throws java.io.IOException
java.io.IOException
- If something goes wrong during closing.protected void assertEmpty(java.io.ByteArrayInputStream is) throws java.io.IOException
is
- The InputStream to check.java.io.IOException
- If is is not empty.protected void flush() throws java.io.IOException
java.io.IOException