author | ascarpino |
Wed, 08 Feb 2017 12:08:28 -0800 | |
changeset 43701 | fe8c324ba97c |
parent 30904 | ec0224270f90 |
permissions | -rw-r--r-- |
2 | 1 |
/* |
30904 | 2 |
* Copyright (c) 1996, 2015, Oracle and/or its affiliates. All rights reserved. |
2 | 3 |
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
4 |
* |
|
5 |
* This code is free software; you can redistribute it and/or modify it |
|
6 |
* under the terms of the GNU General Public License version 2 only, as |
|
5506 | 7 |
* published by the Free Software Foundation. Oracle designates this |
2 | 8 |
* particular file as subject to the "Classpath" exception as provided |
5506 | 9 |
* by Oracle in the LICENSE file that accompanied this code. |
2 | 10 |
* |
11 |
* This code is distributed in the hope that it will be useful, but WITHOUT |
|
12 |
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
|
13 |
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License |
|
14 |
* version 2 for more details (a copy is included in the LICENSE file that |
|
15 |
* accompanied this code). |
|
16 |
* |
|
17 |
* You should have received a copy of the GNU General Public License version |
|
18 |
* 2 along with this work; if not, write to the Free Software Foundation, |
|
19 |
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. |
|
20 |
* |
|
5506 | 21 |
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA |
22 |
* or visit www.oracle.com if you need additional information or have any |
|
23 |
* questions. |
|
2 | 24 |
*/ |
25 |
||
26 |
package sun.security.ssl; |
|
27 |
||
28 |
/** |
|
30904 | 29 |
* SSL/TLS/DTLS records, as pulled off (and put onto) a TCP stream. This is |
2 | 30 |
* the base interface, which defines common information and interfaces |
31 |
* used by both Input and Output records. |
|
32 |
* |
|
33 |
* @author David Brownell |
|
34 |
*/ |
|
35 |
interface Record { |
|
30904 | 36 |
|
2 | 37 |
/* |
30904 | 38 |
* There are four record types, which are part of the interface |
39 |
* to this level (along with the maximum record size). |
|
2 | 40 |
* |
41 |
* enum { change_cipher_spec(20), alert(21), handshake(22), |
|
42 |
* application_data(23), (255) } ContentType; |
|
43 |
*/ |
|
44 |
static final byte ct_change_cipher_spec = 20; |
|
45 |
static final byte ct_alert = 21; |
|
46 |
static final byte ct_handshake = 22; |
|
47 |
static final byte ct_application_data = 23; |
|
48 |
||
30904 | 49 |
static final int maxMacSize = 48; // the max supported MAC or |
50 |
// AEAD tag size |
|
7039 | 51 |
static final int maxDataSize = 16384; // 2^14 bytes of data |
52 |
static final int maxPadding = 256; // block cipher padding |
|
30904 | 53 |
static final int maxIVLength = 16; // the max supported IV length |
2 | 54 |
|
30904 | 55 |
static final int maxFragmentSize = 18432; // the max fragment size |
56 |
// 2^14 + 2048 |
|
10915 | 57 |
|
58 |
/* |
|
30904 | 59 |
* System property to enable/disable CBC protection in SSL3/TLS1. |
10915 | 60 |
*/ |
30904 | 61 |
static final boolean enableCBCProtection = |
62 |
Debug.getBooleanProperty("jsse.enableCBCProtection", true); |
|
2 | 63 |
|
14004
611031f93e76
7200295: CertificateRequest message is wrapping when using large numbers of Certs
xuelei
parents:
10915
diff
changeset
|
64 |
/* |
611031f93e76
7200295: CertificateRequest message is wrapping when using large numbers of Certs
xuelei
parents:
10915
diff
changeset
|
65 |
* The overflow values of integers of 8, 16 and 24 bits. |
611031f93e76
7200295: CertificateRequest message is wrapping when using large numbers of Certs
xuelei
parents:
10915
diff
changeset
|
66 |
*/ |
611031f93e76
7200295: CertificateRequest message is wrapping when using large numbers of Certs
xuelei
parents:
10915
diff
changeset
|
67 |
static final int OVERFLOW_OF_INT08 = (1 << 8); |
611031f93e76
7200295: CertificateRequest message is wrapping when using large numbers of Certs
xuelei
parents:
10915
diff
changeset
|
68 |
static final int OVERFLOW_OF_INT16 = (1 << 16); |
611031f93e76
7200295: CertificateRequest message is wrapping when using large numbers of Certs
xuelei
parents:
10915
diff
changeset
|
69 |
static final int OVERFLOW_OF_INT24 = (1 << 24); |
30904 | 70 |
|
71 |
/** |
|
72 |
* Return a description for the given content type. |
|
73 |
*/ |
|
74 |
static String contentName(byte contentType) { |
|
75 |
switch (contentType) { |
|
76 |
case ct_change_cipher_spec: |
|
77 |
return "Change Cipher Spec"; |
|
78 |
case ct_alert: |
|
79 |
return "Alert"; |
|
80 |
case ct_handshake: |
|
81 |
return "Handshake"; |
|
82 |
case ct_application_data: |
|
83 |
return "Application Data"; |
|
84 |
default: |
|
85 |
return "contentType = " + contentType; |
|
86 |
} |
|
87 |
} |
|
88 |
||
89 |
static boolean isValidContentType(byte contentType) { |
|
90 |
return (contentType == 20) || (contentType == 21) || |
|
91 |
(contentType == 22) || (contentType == 23); |
|
92 |
} |
|
2 | 93 |
} |