看了API描述还是不太清楚,所以翻源码来读,就清楚多了。
//定义的SSL 常量
interface Record {
static final byte ct_change_cipher_spec = 20;
static final byte ct_alert = 21;
static final byte ct_handshake = 22;
static final byte ct_application_data = 23;
static final int headerSize = 5; // SSLv3 record header
static final int maxExpansion = 1024; // for bad compression
static final int trailerSize = 20; // SHA1 hash size
static final int maxDataSize = 16384; // 2^14 bytes of data
static final int maxPadding = 256; // block cipher padding
static final int maxRecordSize = headerSize // header
+ maxDataSize // data
+ maxPadding // padding
+ trailerSize; // MAC
static final int maxLargeRecordSize = maxRecordSize // Max size with a conforming implemenation
+ maxDataSize; // extra 2^14 bytes for large data packets.
static final int maxAlertRecordSize = headerSize + 2 + maxPadding
+ trailerSize;
}
//大致意思,如果此标识为true,就破坏rfc标准,将上限提升到2的15次方
private boolean acceptLargeFragments = Debug.getBooleanProperty(
"jsse.SSLEngine.acceptLargeFragments", false);
public synchronized int getPacketBufferSize() {
return acceptLargeFragments ? Record.maxLargeRecordSize
: Record.maxRecordSize;
}
public synchronized int getApplicationBufferSize() {
return getPacketBufferSize() - Record.headerSize; // getPacketBufferSize() 减去header信息的长度
}
//定义的SSL 常量
interface Record {
static final byte ct_change_cipher_spec = 20;
static final byte ct_alert = 21;
static final byte ct_handshake = 22;
static final byte ct_application_data = 23;
static final int headerSize = 5; // SSLv3 record header
static final int maxExpansion = 1024; // for bad compression
static final int trailerSize = 20; // SHA1 hash size
static final int maxDataSize = 16384; // 2^14 bytes of data
static final int maxPadding = 256; // block cipher padding
static final int maxRecordSize = headerSize // header
+ maxDataSize // data
+ maxPadding // padding
+ trailerSize; // MAC
static final int maxLargeRecordSize = maxRecordSize // Max size with a conforming implemenation
+ maxDataSize; // extra 2^14 bytes for large data packets.
static final int maxAlertRecordSize = headerSize + 2 + maxPadding
+ trailerSize;
}
//大致意思,如果此标识为true,就破坏rfc标准,将上限提升到2的15次方
private boolean acceptLargeFragments = Debug.getBooleanProperty(
"jsse.SSLEngine.acceptLargeFragments", false);
public synchronized int getPacketBufferSize() {
return acceptLargeFragments ? Record.maxLargeRecordSize
: Record.maxRecordSize;
}
public synchronized int getApplicationBufferSize() {
return getPacketBufferSize() - Record.headerSize; // getPacketBufferSize() 减去header信息的长度
}