| java.lang.Object com.sun.midp.ssl.Record
Record | class Record (Code) | | Implements an SSL record layer that sits atop a TCP connection
and beneath the user-visible interface to an SSL socket. It
maintains all the state information necessary to encode/decode
application data.
|
Field Summary | |
final static byte | ALRT Alert (21). | final static byte | APP Application data (23). | final static byte | BAD_CERT Bad certificate alert type (42). | final static byte | BAD_MAC Bad MAC alert type (20). | final static byte | BAD_PARAM Bad parameter alert type (47). | final static byte | CCS Change Cipher Spec (20). | final static byte | CERT_EXPRD Certificate expired alaert type (45). | final static byte | CERT_REVKD Certificate revoked alert type (44). | final static byte | CERT_UNKWN Unknown certificate feature alert type (46). | final static byte | CLIENT Client role for SSL record layout (1). | final static byte | CLOSE_NTFY Close notification alert type (0). | final static byte | FATAL Fatal severity level for alerts (2). | final static byte | HNDSHK Handshake (22). | final static byte | HNDSHK_FAIL Handshake failure alert type (40). | final static byte | NO_CERT No certificate found alert type (41). | final static byte | SERVER Server role for SSL record layout (0). | final static byte | UNEXP_MSG Unexpected message alert type (10). | final static byte | UNSUP_CERT Unsupported certificate alert type (43). | final static byte | WARNING Warning severity level for alerts (1). | byte[] | inputData Current input record data. | int | plainTextLength |
Method Summary | |
public void | alert(byte level, byte type) Sends an alert message of the specified level and type to the SSL peer. | void | closeInputStream() | void | closeOutputStream() | void | init(byte role, byte[] clientRand, byte[] serverRand, byte suite, byte[] masterSecret) Chops up a master secret into the client and server MAC secrets,
bulk encryption keys and IVs. | void | rdRec(boolean block, byte type) Reads and returns a record (including the 5-byte header) of
the specified type. | public void | shutdownConnection() Send a close notify and shutdown the TCP connection if needed. | void | wrRec(byte type, byte[] buf, int off, int len) Writes an SSL record to the underlying socket's output stream.
Parameters: type - record type (one of CCS, ALRT, HNDSHK or APP) Parameters: buf - byte array containing the record body (i.e. |
ALRT | final static byte ALRT(Code) | | Alert (21).
|
APP | final static byte APP(Code) | | Application data (23).
|
BAD_CERT | final static byte BAD_CERT(Code) | | Bad certificate alert type (42).
|
BAD_MAC | final static byte BAD_MAC(Code) | | Bad MAC alert type (20).
|
BAD_PARAM | final static byte BAD_PARAM(Code) | | Bad parameter alert type (47).
|
CCS | final static byte CCS(Code) | | Change Cipher Spec (20).
|
CERT_EXPRD | final static byte CERT_EXPRD(Code) | | Certificate expired alaert type (45).
|
CERT_REVKD | final static byte CERT_REVKD(Code) | | Certificate revoked alert type (44).
|
CERT_UNKWN | final static byte CERT_UNKWN(Code) | | Unknown certificate feature alert type (46).
|
CLIENT | final static byte CLIENT(Code) | | Client role for SSL record layout (1).
|
CLOSE_NTFY | final static byte CLOSE_NTFY(Code) | | Close notification alert type (0).
|
FATAL | final static byte FATAL(Code) | | Fatal severity level for alerts (2).
|
HNDSHK | final static byte HNDSHK(Code) | | Handshake (22).
|
HNDSHK_FAIL | final static byte HNDSHK_FAIL(Code) | | Handshake failure alert type (40).
|
NO_CERT | final static byte NO_CERT(Code) | | No certificate found alert type (41).
|
SERVER | final static byte SERVER(Code) | | Server role for SSL record layout (0).
|
UNEXP_MSG | final static byte UNEXP_MSG(Code) | | Unexpected message alert type (10).
|
UNSUP_CERT | final static byte UNSUP_CERT(Code) | | Unsupported certificate alert type (43).
|
WARNING | final static byte WARNING(Code) | | Warning severity level for alerts (1).
|
inputData | byte[] inputData(Code) | | Current input record data.
|
plainTextLength | int plainTextLength(Code) | | Length of the plain text in the input buffer
|
Record | Record(InputStream ins, OutputStream outs)(Code) | | Creates a new SSL record layer.
Parameters: ins - input stream belonging to the underlying TCP connection Parameters: outs - output stream belonging to the underlying TCP connection |
alert | public void alert(byte level, byte type)(Code) | | Sends an alert message of the specified level and type to the SSL peer.
Parameters: level - one of WARNING or FATAL) Parameters: type - one of CLOSE_NTFY, UNEXP_MSG, BAD_MAC, DECOMP_FAIL,HNDSHK_FAIL, NO_CERT, BAD_CERT, UNSUP_CERT, CERT_REVKD,CERT_EXPRD, CERT_UNKWN, BAD_PARAM |
closeInputStream | void closeInputStream()(Code) | | Close input stream
|
closeOutputStream | void closeOutputStream()(Code) | | Close output stream
|
init | void init(byte role, byte[] clientRand, byte[] serverRand, byte suite, byte[] masterSecret) throws Exception(Code) | | Chops up a master secret into the client and server MAC secrets,
bulk encryption keys and IVs. Also initializes the Cipher and
MessageDigest objects used in record encoding/decoding.
Parameters: role - role (either CLIENT or SERVER) of this side in the SSL negotiation Parameters: clientRand - 32-byte random value chosen by the client Parameters: serverRand - 32-byte random value chosen by the server Parameters: suite - negotiated cipher suite Parameters: masterSecret - master secret resulting from the key exchange exception: Exception - if the negotiated cipher suite involves an unsupported hash or cipher algorithm |
rdRec | void rdRec(boolean block, byte type) throws IOException(Code) | | Reads and returns a record (including the 5-byte header) of
the specified type. If the caller asks for application data
and a close_notify warning alert is found as the next available
record, this method sets plainTextLength to -1 to signal the end of the
input stream.
Parameters: block - if true the method will not return until data is available,or end of stream Parameters: type - desired SSL record type exception: IOException - if an unexpected record type or SSL alert isfound in the underlying sockets input stream |
shutdownConnection | public void shutdownConnection()(Code) | | Send a close notify and shutdown the TCP connection if needed.
|
wrRec | void wrRec(byte type, byte[] buf, int off, int len) throws IOException(Code) | | Writes an SSL record to the underlying socket's output stream.
Parameters: type - record type (one of CCS, ALRT, HNDSHK or APP) Parameters: buf - byte array containing the record body (i.e. everythingbut the 5-byte header) Parameters: off - starting offset of the record body inside buf Parameters: len - length of the record body, the maximum is 2^14 +2048 asdefined by RFC 2246 exception: IOException - if an I/O error occurs. |
|
|