Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
PojavLauncherTeam
GitHub Repository: PojavLauncherTeam/openjdk-multiarch-jdk8u
Path: blob/aarch64-shenandoah-jdk8u272-b10/jdk/src/share/classes/sun/security/internal/spec/TlsKeyMaterialSpec.java
38922 views
1
/*
2
* Copyright (c) 2005, 2013, Oracle and/or its affiliates. All rights reserved.
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
7
* published by the Free Software Foundation. Oracle designates this
8
* particular file as subject to the "Classpath" exception as provided
9
* by Oracle in the LICENSE file that accompanied this code.
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
*
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.
24
*/
25
26
package sun.security.internal.spec;
27
28
import java.security.spec.KeySpec;
29
30
import javax.crypto.SecretKey;
31
import javax.crypto.spec.IvParameterSpec;
32
33
/**
34
* KeySpec class for SSL/TLS key material.
35
*
36
* <p>Instances of this class are returned by the <code>generateKey()</code>
37
* method of KeyGenerators of the type "TlsKeyMaterial".
38
* Instances of this class are immutable.
39
*
40
* @since 1.6
41
* @author Andreas Sterbenz
42
* @deprecated Sun JDK internal use only --- WILL BE REMOVED in a future
43
* release.
44
*/
45
@Deprecated
46
public class TlsKeyMaterialSpec implements KeySpec, SecretKey {
47
48
static final long serialVersionUID = 812912859129525028L;
49
50
private final SecretKey clientMacKey, serverMacKey;
51
private final SecretKey clientCipherKey, serverCipherKey;
52
private final IvParameterSpec clientIv, serverIv;
53
54
/**
55
* Constructs a new TlsKeymaterialSpec from the client and server MAC
56
* keys.
57
* This call is equivalent to
58
* <code>new TlsKeymaterialSpec(clientMacKey, serverMacKey,
59
* null, null, null, null)</code>.
60
*
61
* @param clientMacKey the client MAC key (or null)
62
* @param serverMacKey the server MAC key (or null)
63
*/
64
public TlsKeyMaterialSpec(SecretKey clientMacKey, SecretKey serverMacKey) {
65
this(clientMacKey, serverMacKey, null, null, null, null);
66
}
67
68
/**
69
* Constructs a new TlsKeymaterialSpec from the client and server MAC
70
* keys and client and server cipher keys.
71
* This call is equivalent to
72
* <code>new TlsKeymaterialSpec(clientMacKey, serverMacKey,
73
* clientCipherKey, serverCipherKey, null, null)</code>.
74
*
75
* @param clientMacKey the client MAC key (or null)
76
* @param serverMacKey the server MAC key (or null)
77
* @param clientCipherKey the client cipher key (or null)
78
* @param serverCipherKey the server cipher key (or null)
79
*/
80
public TlsKeyMaterialSpec(SecretKey clientMacKey, SecretKey serverMacKey,
81
SecretKey clientCipherKey, SecretKey serverCipherKey) {
82
this(clientMacKey, serverMacKey, clientCipherKey, null,
83
serverCipherKey, null);
84
}
85
86
/**
87
* Constructs a new TlsKeymaterialSpec from the client and server MAC
88
* keys, client and server cipher keys, and client and server
89
* initialization vectors.
90
*
91
* @param clientMacKey the client MAC key (or null)
92
* @param serverMacKey the server MAC key (or null)
93
* @param clientCipherKey the client cipher key (or null)
94
* @param clientIv the client initialization vector (or null)
95
* @param serverCipherKey the server cipher key (or null)
96
* @param serverIv the server initialization vector (or null)
97
*/
98
public TlsKeyMaterialSpec(SecretKey clientMacKey, SecretKey serverMacKey,
99
SecretKey clientCipherKey, IvParameterSpec clientIv,
100
SecretKey serverCipherKey, IvParameterSpec serverIv) {
101
102
this.clientMacKey = clientMacKey;
103
this.serverMacKey = serverMacKey;
104
this.clientCipherKey = clientCipherKey;
105
this.serverCipherKey = serverCipherKey;
106
this.clientIv = clientIv;
107
this.serverIv = serverIv;
108
}
109
110
/**
111
* Returns <code>TlsKeyMaterial</code>.
112
*
113
* @return <code>TlsKeyMaterial</code>.
114
*/
115
public String getAlgorithm() {
116
return "TlsKeyMaterial";
117
}
118
119
/**
120
* Returns <code>null</code> because keys of this type have no encoding.
121
*
122
* @return <code>null</code> because keys of this type have no encoding.
123
*/
124
public String getFormat() {
125
return null;
126
}
127
128
/**
129
* Returns <code>null</code> because keys of this type have no encoding.
130
*
131
* @return <code>null</code> because keys of this type have no encoding.
132
*/
133
public byte[] getEncoded() {
134
return null;
135
}
136
137
/**
138
* Returns the client MAC key.
139
*
140
* @return the client MAC key (or null).
141
*/
142
public SecretKey getClientMacKey() {
143
return clientMacKey;
144
}
145
146
/**
147
* Return the server MAC key.
148
*
149
* @return the server MAC key (or null).
150
*/
151
public SecretKey getServerMacKey() {
152
return serverMacKey;
153
}
154
155
/**
156
* Return the client cipher key (or null).
157
*
158
* @return the client cipher key (or null).
159
*/
160
public SecretKey getClientCipherKey() {
161
return clientCipherKey;
162
}
163
164
/**
165
* Return the client initialization vector (or null).
166
*
167
* @return the client initialization vector (or null).
168
*/
169
public IvParameterSpec getClientIv() {
170
return clientIv;
171
}
172
173
/**
174
* Return the server cipher key (or null).
175
*
176
* @return the server cipher key (or null).
177
*/
178
public SecretKey getServerCipherKey() {
179
return serverCipherKey;
180
}
181
182
/**
183
* Return the server initialization vector (or null).
184
*
185
* @return the server initialization vector (or null).
186
*/
187
public IvParameterSpec getServerIv() {
188
return serverIv;
189
}
190
191
}
192
193