Package org.conscrypt
Class AlertProtocol
java.lang.Object
org.conscrypt.AlertProtocol
public class AlertProtocol extends Object
This class encapsulates the functionality of Alert Protocol.
Constant values are taken according to the TLS v1 specification
(http://www.ietf.org/rfc/rfc2246.txt), p 7.2.
-
Field Summary
Fields Modifier and Type Field Description protected static byteACCESS_DENIEDDefines the description code of the access_denied alertprotected static byteBAD_CERTIFICATEDefines the description code of the bad_certificate alertprotected static byteBAD_RECORD_MACDefines the description code of the bad_record_mac alertprotected static byteCERTIFICATE_EXPIREDDefines the description code of the certificate_expired alertprotected static byteCERTIFICATE_REVOKEDDefines the description code of the certificate_revoked alertprotected static byteCERTIFICATE_UNKNOWNDefines the description code of the certificate_unknown alertprotected static byteCLOSE_NOTIFYDefines the description code of the close_notify alertprotected static byteDECODE_ERRORDefines the description code of the decode_error alertprotected static byteDECOMPRESSION_FAILUREDefines the description code of the decompression_failure alertprotected static byteDECRYPT_ERRORDefines the description code of the decrypt_error alertprotected static byteDECRYPTION_FAILEDDefines the description code of the decryption_failed alertprotected static byteEXPORT_RESTRICTIONDefines the description code of the export_restriction alertprotected static byteFATALDefines the severity of alert as fatalprotected static byteHANDSHAKE_FAILUREDefines the description code of the handshake_failure alertprotected static byteILLEGAL_PARAMETERDefines the description code of the illegal_parameter alertprotected static byteINSUFFICIENT_SECURITYDefines the description code of the insufficient_security alertprotected static byteINTERNAL_ERRORDefines the description code of the internal_error alertprotected static byteNO_RENEGOTIATIONDefines the description code of the no_renegotiation alertprotected static bytePROTOCOL_VERSIONDefines the description code of the protocol_version alertprotected static byteRECORD_OVERFLOWDefines the description code of the record_overflow alertprotected static byteUNEXPECTED_MESSAGEDefines the description code of the unexpected_message alertprotected static byteUNKNOWN_CADefines the description code of the unknown_ca alertprotected static byteUNSUPPORTED_CERTIFICATEDefines the description code of the unsupported_certificate alertprotected static byteUSER_CANCELEDDefines the description code of the user_canceled alertprotected static byteWARNINGDefines the severity of alert as warning -
Constructor Summary
Constructors Modifier Constructor Description protectedAlertProtocol()Creates the instance of AlertProtocol. -
Method Summary
Modifier and Type Method Description protected voidalert(byte level, byte description)Reports an alert to be sent/received by transport.protected StringgetAlertDescription()Returns the string representation of occured alert.protected bytegetDescriptionCode()Returns the description code of alert or -100 if there is no alert.protected booleanhasAlert()Checks if any alert has occured.protected booleanisFatalAlert()Checks if occured alert is fatal alert.protected voidsetProcessed()Resets the protocol to be in "no alert" state.protected voidsetRecordProtocol(SSLRecordProtocol recordProtocol)Sets up the record protocol to be used by this allert protocol.protected voidshutdown()Shutdown the protocol.protected byte[]wrap()Returns the record with reported alert message.
-
Field Details
-
WARNING
protected static final byte WARNINGDefines the severity of alert as warning- See Also:
- Constant Field Values
-
FATAL
protected static final byte FATALDefines the severity of alert as fatal- See Also:
- Constant Field Values
-
CLOSE_NOTIFY
protected static final byte CLOSE_NOTIFYDefines the description code of the close_notify alert- See Also:
- Constant Field Values
-
UNEXPECTED_MESSAGE
protected static final byte UNEXPECTED_MESSAGEDefines the description code of the unexpected_message alert- See Also:
- Constant Field Values
-
BAD_RECORD_MAC
protected static final byte BAD_RECORD_MACDefines the description code of the bad_record_mac alert- See Also:
- Constant Field Values
-
DECRYPTION_FAILED
protected static final byte DECRYPTION_FAILEDDefines the description code of the decryption_failed alert- See Also:
- Constant Field Values
-
RECORD_OVERFLOW
protected static final byte RECORD_OVERFLOWDefines the description code of the record_overflow alert- See Also:
- Constant Field Values
-
DECOMPRESSION_FAILURE
protected static final byte DECOMPRESSION_FAILUREDefines the description code of the decompression_failure alert- See Also:
- Constant Field Values
-
HANDSHAKE_FAILURE
protected static final byte HANDSHAKE_FAILUREDefines the description code of the handshake_failure alert- See Also:
- Constant Field Values
-
BAD_CERTIFICATE
protected static final byte BAD_CERTIFICATEDefines the description code of the bad_certificate alert- See Also:
- Constant Field Values
-
UNSUPPORTED_CERTIFICATE
protected static final byte UNSUPPORTED_CERTIFICATEDefines the description code of the unsupported_certificate alert- See Also:
- Constant Field Values
-
CERTIFICATE_REVOKED
protected static final byte CERTIFICATE_REVOKEDDefines the description code of the certificate_revoked alert- See Also:
- Constant Field Values
-
CERTIFICATE_EXPIRED
protected static final byte CERTIFICATE_EXPIREDDefines the description code of the certificate_expired alert- See Also:
- Constant Field Values
-
CERTIFICATE_UNKNOWN
protected static final byte CERTIFICATE_UNKNOWNDefines the description code of the certificate_unknown alert- See Also:
- Constant Field Values
-
ILLEGAL_PARAMETER
protected static final byte ILLEGAL_PARAMETERDefines the description code of the illegal_parameter alert- See Also:
- Constant Field Values
-
UNKNOWN_CA
protected static final byte UNKNOWN_CADefines the description code of the unknown_ca alert- See Also:
- Constant Field Values
-
ACCESS_DENIED
protected static final byte ACCESS_DENIEDDefines the description code of the access_denied alert- See Also:
- Constant Field Values
-
DECODE_ERROR
protected static final byte DECODE_ERRORDefines the description code of the decode_error alert- See Also:
- Constant Field Values
-
DECRYPT_ERROR
protected static final byte DECRYPT_ERRORDefines the description code of the decrypt_error alert- See Also:
- Constant Field Values
-
EXPORT_RESTRICTION
protected static final byte EXPORT_RESTRICTIONDefines the description code of the export_restriction alert- See Also:
- Constant Field Values
-
PROTOCOL_VERSION
protected static final byte PROTOCOL_VERSIONDefines the description code of the protocol_version alert- See Also:
- Constant Field Values
-
INSUFFICIENT_SECURITY
protected static final byte INSUFFICIENT_SECURITYDefines the description code of the insufficient_security alert- See Also:
- Constant Field Values
-
INTERNAL_ERROR
protected static final byte INTERNAL_ERRORDefines the description code of the internal_error alert- See Also:
- Constant Field Values
-
USER_CANCELED
protected static final byte USER_CANCELEDDefines the description code of the user_canceled alert- See Also:
- Constant Field Values
-
NO_RENEGOTIATION
protected static final byte NO_RENEGOTIATIONDefines the description code of the no_renegotiation alert- See Also:
- Constant Field Values
-
-
Constructor Details
-
AlertProtocol
protected AlertProtocol()Creates the instance of AlertProtocol. Note that class is not ready to work without providing of record protocol
-
-
Method Details
-
setRecordProtocol
Sets up the record protocol to be used by this allert protocol. -
alert
protected void alert(byte level, byte description)Reports an alert to be sent/received by transport. This method is usually called during processing of the income TSL record: if it contains alert message from another peer, or if warning alert occured during the processing of the message and this warning should be sent to another peer.- Parameters:
level- alert level codedescription- alert description code
-
getDescriptionCode
protected byte getDescriptionCode()Returns the description code of alert or -100 if there is no alert. -
setProcessed
protected void setProcessed()Resets the protocol to be in "no alert" state. This method shoud be called after processing of the reported alert. -
hasAlert
protected boolean hasAlert()Checks if any alert has occured. -
isFatalAlert
protected boolean isFatalAlert()Checks if occured alert is fatal alert. -
getAlertDescription
Returns the string representation of occured alert. If no alert has occured null is returned. -
wrap
protected byte[] wrap()Returns the record with reported alert message. The returned array of bytes is ready to be sent to another peer. Note, that this method does not automatically set the state of alert protocol in "no alert" state, so after wrapping the method setProcessed should be called. -
shutdown
protected void shutdown()Shutdown the protocol. It will be impossible to use the instance after the calling of this method.
-