author | weijun |
Sat, 09 Mar 2013 17:27:58 +0800 | |
changeset 16065 | 2d0b844bfbb6 |
parent 15006 | 10d6aacdd67f |
child 18536 | 092411ced388 |
permissions | -rw-r--r-- |
1454 | 1 |
/* |
14342
8435a30053c1
7197491: update copyright year to match last edit in jdk8 jdk repository
alanb
parents:
12199
diff
changeset
|
2 |
* Copyright (c) 2008, 2012, Oracle and/or its affiliates. All rights reserved. |
1454 | 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. |
|
8 |
* |
|
9 |
* This code is distributed in the hope that it will be useful, but WITHOUT |
|
10 |
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
|
11 |
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License |
|
12 |
* version 2 for more details (a copy is included in the LICENSE file that |
|
13 |
* accompanied this code). |
|
14 |
* |
|
15 |
* You should have received a copy of the GNU General Public License version |
|
16 |
* 2 along with this work; if not, write to the Free Software Foundation, |
|
17 |
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. |
|
18 |
* |
|
5506 | 19 |
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA |
20 |
* or visit www.oracle.com if you need additional information or have any |
|
21 |
* questions. |
|
1454 | 22 |
*/ |
23 |
||
24 |
import com.sun.security.auth.module.Krb5LoginModule; |
|
3482
4aaa66ce712d
6710360: export Kerberos session key to applications
weijun
parents:
1575
diff
changeset
|
25 |
import java.security.Key; |
1454 | 26 |
import java.security.PrivilegedActionException; |
27 |
import java.security.PrivilegedExceptionAction; |
|
28 |
import java.util.Arrays; |
|
29 |
import java.util.HashMap; |
|
30 |
import java.util.Map; |
|
31 |
import javax.security.auth.Subject; |
|
32 |
import javax.security.auth.kerberos.KerberosKey; |
|
33 |
import javax.security.auth.kerberos.KerberosTicket; |
|
34 |
import javax.security.auth.login.LoginContext; |
|
35 |
import org.ietf.jgss.GSSContext; |
|
36 |
import org.ietf.jgss.GSSCredential; |
|
37 |
import org.ietf.jgss.GSSException; |
|
38 |
import org.ietf.jgss.GSSManager; |
|
39 |
import org.ietf.jgss.GSSName; |
|
40 |
import org.ietf.jgss.MessageProp; |
|
41 |
import org.ietf.jgss.Oid; |
|
3482
4aaa66ce712d
6710360: export Kerberos session key to applications
weijun
parents:
1575
diff
changeset
|
42 |
import com.sun.security.jgss.ExtendedGSSContext; |
4aaa66ce712d
6710360: export Kerberos session key to applications
weijun
parents:
1575
diff
changeset
|
43 |
import com.sun.security.jgss.InquireType; |
3483
a16fce1820ef
6821190: more InquireType values for ExtendedGSSContext
weijun
parents:
3482
diff
changeset
|
44 |
import com.sun.security.jgss.AuthorizationDataEntry; |
14413
e954df027393
6355584: Introduce constrained Kerberos delegation
weijun
parents:
14342
diff
changeset
|
45 |
import com.sun.security.jgss.ExtendedGSSCredential; |
7801
814c8359b104
6975866: api/org_ietf/jgss/GSSContext/index.html#wrapUnwrapIOTest started to fail since jdk7 b102
weijun
parents:
5774
diff
changeset
|
46 |
import java.io.ByteArrayInputStream; |
814c8359b104
6975866: api/org_ietf/jgss/GSSContext/index.html#wrapUnwrapIOTest started to fail since jdk7 b102
weijun
parents:
5774
diff
changeset
|
47 |
import java.io.ByteArrayOutputStream; |
14413
e954df027393
6355584: Introduce constrained Kerberos delegation
weijun
parents:
14342
diff
changeset
|
48 |
import java.security.Principal; |
1454 | 49 |
|
50 |
/** |
|
51 |
* Context of a JGSS subject, encapsulating Subject and GSSContext. |
|
52 |
* |
|
53 |
* Three "constructors", which acquire the (private) credentials and fill |
|
54 |
* it into the Subject: |
|
55 |
* |
|
56 |
* 1. static fromJAAS(): Creates a Context using a JAAS login config entry |
|
57 |
* 2. static fromUserPass(): Creates a Context using a username and a password |
|
58 |
* 3. delegated(): A new context which uses the delegated credentials from a |
|
59 |
* previously established acceptor Context |
|
60 |
* |
|
61 |
* Two context initiators, which create the GSSContext object inside: |
|
62 |
* |
|
63 |
* 1. startAsClient() |
|
64 |
* 2. startAsServer() |
|
65 |
* |
|
66 |
* Privileged action: |
|
67 |
* doAs(): Performs an action in the name of the Subject |
|
68 |
* |
|
69 |
* Handshake process: |
|
70 |
* static handShake(initiator, acceptor) |
|
71 |
* |
|
72 |
* A four-phase typical data communication which includes all four GSS |
|
73 |
* actions (wrap, unwrap, getMic and veryfyMiC): |
|
74 |
* static transmit(message, from, to) |
|
75 |
*/ |
|
76 |
public class Context { |
|
77 |
||
78 |
private Subject s; |
|
4336 | 79 |
private ExtendedGSSContext x; |
1454 | 80 |
private String name; |
81 |
private GSSCredential cred; // see static method delegated(). |
|
82 |
||
7801
814c8359b104
6975866: api/org_ietf/jgss/GSSContext/index.html#wrapUnwrapIOTest started to fail since jdk7 b102
weijun
parents:
5774
diff
changeset
|
83 |
static boolean usingStream = false; |
814c8359b104
6975866: api/org_ietf/jgss/GSSContext/index.html#wrapUnwrapIOTest started to fail since jdk7 b102
weijun
parents:
5774
diff
changeset
|
84 |
|
1454 | 85 |
private Context() {} |
86 |
||
87 |
/** |
|
88 |
* Using the delegated credentials from a previous acceptor |
|
89 |
* @param c |
|
90 |
*/ |
|
91 |
public Context delegated() throws Exception { |
|
92 |
Context out = new Context(); |
|
93 |
out.s = s; |
|
14413
e954df027393
6355584: Introduce constrained Kerberos delegation
weijun
parents:
14342
diff
changeset
|
94 |
try { |
e954df027393
6355584: Introduce constrained Kerberos delegation
weijun
parents:
14342
diff
changeset
|
95 |
out.cred = Subject.doAs(s, new PrivilegedExceptionAction<GSSCredential>() { |
e954df027393
6355584: Introduce constrained Kerberos delegation
weijun
parents:
14342
diff
changeset
|
96 |
@Override |
e954df027393
6355584: Introduce constrained Kerberos delegation
weijun
parents:
14342
diff
changeset
|
97 |
public GSSCredential run() throws Exception { |
e954df027393
6355584: Introduce constrained Kerberos delegation
weijun
parents:
14342
diff
changeset
|
98 |
GSSCredential cred = x.getDelegCred(); |
e954df027393
6355584: Introduce constrained Kerberos delegation
weijun
parents:
14342
diff
changeset
|
99 |
if (cred == null && x.getCredDelegState() || |
e954df027393
6355584: Introduce constrained Kerberos delegation
weijun
parents:
14342
diff
changeset
|
100 |
cred != null && !x.getCredDelegState()) { |
e954df027393
6355584: Introduce constrained Kerberos delegation
weijun
parents:
14342
diff
changeset
|
101 |
throw new Exception("getCredDelegState not match"); |
e954df027393
6355584: Introduce constrained Kerberos delegation
weijun
parents:
14342
diff
changeset
|
102 |
} |
e954df027393
6355584: Introduce constrained Kerberos delegation
weijun
parents:
14342
diff
changeset
|
103 |
return cred; |
e954df027393
6355584: Introduce constrained Kerberos delegation
weijun
parents:
14342
diff
changeset
|
104 |
} |
e954df027393
6355584: Introduce constrained Kerberos delegation
weijun
parents:
14342
diff
changeset
|
105 |
}); |
e954df027393
6355584: Introduce constrained Kerberos delegation
weijun
parents:
14342
diff
changeset
|
106 |
} catch (PrivilegedActionException pae) { |
e954df027393
6355584: Introduce constrained Kerberos delegation
weijun
parents:
14342
diff
changeset
|
107 |
throw pae.getException(); |
e954df027393
6355584: Introduce constrained Kerberos delegation
weijun
parents:
14342
diff
changeset
|
108 |
} |
1454 | 109 |
out.name = name + " as " + out.cred.getName().toString(); |
110 |
return out; |
|
111 |
} |
|
112 |
||
113 |
/** |
|
12199 | 114 |
* No JAAS login at all, can be used to test JGSS without JAAS |
115 |
*/ |
|
116 |
public static Context fromThinAir() throws Exception { |
|
117 |
Context out = new Context(); |
|
118 |
out.s = new Subject(); |
|
119 |
return out; |
|
120 |
} |
|
121 |
||
122 |
/** |
|
1454 | 123 |
* Logins with a JAAS login config entry name |
124 |
*/ |
|
125 |
public static Context fromJAAS(final String name) throws Exception { |
|
126 |
Context out = new Context(); |
|
127 |
out.name = name; |
|
128 |
LoginContext lc = new LoginContext(name); |
|
129 |
lc.login(); |
|
130 |
out.s = lc.getSubject(); |
|
131 |
return out; |
|
132 |
} |
|
133 |
||
15006 | 134 |
/** |
135 |
* Logins with username/password as a new Subject |
|
136 |
*/ |
|
9499 | 137 |
public static Context fromUserPass( |
138 |
String user, char[] pass, boolean storeKey) throws Exception { |
|
15006 | 139 |
return fromUserPass(new Subject(), user, pass, storeKey); |
9499 | 140 |
} |
12199 | 141 |
|
1454 | 142 |
/** |
15006 | 143 |
* Logins with username/password as an existing Subject. The |
144 |
* same subject can be used multiple times to simulate multiple logins. |
|
145 |
* @param s existing subject |
|
1454 | 146 |
*/ |
9499 | 147 |
public static Context fromUserPass(Subject s, |
148 |
String user, char[] pass, boolean storeKey) throws Exception { |
|
1454 | 149 |
Context out = new Context(); |
150 |
out.name = user; |
|
15006 | 151 |
out.s = s; |
1454 | 152 |
Krb5LoginModule krb5 = new Krb5LoginModule(); |
7977
f47f211cd627
7008713: diamond conversion of kerberos5 and security tools
smarks
parents:
7816
diff
changeset
|
153 |
Map<String, String> map = new HashMap<>(); |
f47f211cd627
7008713: diamond conversion of kerberos5 and security tools
smarks
parents:
7816
diff
changeset
|
154 |
Map<String, Object> shared = new HashMap<>(); |
1575
e0f1979051b5
6765491: Krb5LoginModule a little too restrictive, and the doc is not clear.
weijun
parents:
1574
diff
changeset
|
155 |
|
e0f1979051b5
6765491: Krb5LoginModule a little too restrictive, and the doc is not clear.
weijun
parents:
1574
diff
changeset
|
156 |
if (pass != null) { |
e0f1979051b5
6765491: Krb5LoginModule a little too restrictive, and the doc is not clear.
weijun
parents:
1574
diff
changeset
|
157 |
map.put("useFirstPass", "true"); |
e0f1979051b5
6765491: Krb5LoginModule a little too restrictive, and the doc is not clear.
weijun
parents:
1574
diff
changeset
|
158 |
shared.put("javax.security.auth.login.name", user); |
e0f1979051b5
6765491: Krb5LoginModule a little too restrictive, and the doc is not clear.
weijun
parents:
1574
diff
changeset
|
159 |
shared.put("javax.security.auth.login.password", pass); |
e0f1979051b5
6765491: Krb5LoginModule a little too restrictive, and the doc is not clear.
weijun
parents:
1574
diff
changeset
|
160 |
} else { |
e0f1979051b5
6765491: Krb5LoginModule a little too restrictive, and the doc is not clear.
weijun
parents:
1574
diff
changeset
|
161 |
map.put("doNotPrompt", "true"); |
e0f1979051b5
6765491: Krb5LoginModule a little too restrictive, and the doc is not clear.
weijun
parents:
1574
diff
changeset
|
162 |
map.put("useTicketCache", "true"); |
e0f1979051b5
6765491: Krb5LoginModule a little too restrictive, and the doc is not clear.
weijun
parents:
1574
diff
changeset
|
163 |
if (user != null) { |
e0f1979051b5
6765491: Krb5LoginModule a little too restrictive, and the doc is not clear.
weijun
parents:
1574
diff
changeset
|
164 |
map.put("principal", user); |
e0f1979051b5
6765491: Krb5LoginModule a little too restrictive, and the doc is not clear.
weijun
parents:
1574
diff
changeset
|
165 |
} |
e0f1979051b5
6765491: Krb5LoginModule a little too restrictive, and the doc is not clear.
weijun
parents:
1574
diff
changeset
|
166 |
} |
1454 | 167 |
if (storeKey) { |
168 |
map.put("storeKey", "true"); |
|
169 |
} |
|
170 |
||
171 |
krb5.initialize(out.s, null, shared, map); |
|
172 |
krb5.login(); |
|
173 |
krb5.commit(); |
|
174 |
return out; |
|
175 |
} |
|
176 |
||
177 |
/** |
|
15006 | 178 |
* Logins with username/keytab as an existing Subject. The |
179 |
* same subject can be used multiple times to simulate multiple logins. |
|
180 |
* @param s existing subject |
|
5774
4b9857e483c1
6951366: kerberos login failure on win2008 with AD set to win2000 compat mode
weijun
parents:
5506
diff
changeset
|
181 |
*/ |
15006 | 182 |
public static Context fromUserKtab( |
183 |
String user, String ktab, boolean storeKey) throws Exception { |
|
184 |
return fromUserKtab(new Subject(), user, ktab, storeKey); |
|
185 |
} |
|
186 |
||
187 |
/** |
|
188 |
* Logins with username/keytab as a new subject, |
|
189 |
*/ |
|
190 |
public static Context fromUserKtab(Subject s, |
|
191 |
String user, String ktab, boolean storeKey) throws Exception { |
|
5774
4b9857e483c1
6951366: kerberos login failure on win2008 with AD set to win2000 compat mode
weijun
parents:
5506
diff
changeset
|
192 |
Context out = new Context(); |
4b9857e483c1
6951366: kerberos login failure on win2008 with AD set to win2000 compat mode
weijun
parents:
5506
diff
changeset
|
193 |
out.name = user; |
15006 | 194 |
out.s = s; |
5774
4b9857e483c1
6951366: kerberos login failure on win2008 with AD set to win2000 compat mode
weijun
parents:
5506
diff
changeset
|
195 |
Krb5LoginModule krb5 = new Krb5LoginModule(); |
7977
f47f211cd627
7008713: diamond conversion of kerberos5 and security tools
smarks
parents:
7816
diff
changeset
|
196 |
Map<String, String> map = new HashMap<>(); |
5774
4b9857e483c1
6951366: kerberos login failure on win2008 with AD set to win2000 compat mode
weijun
parents:
5506
diff
changeset
|
197 |
|
4b9857e483c1
6951366: kerberos login failure on win2008 with AD set to win2000 compat mode
weijun
parents:
5506
diff
changeset
|
198 |
map.put("doNotPrompt", "true"); |
4b9857e483c1
6951366: kerberos login failure on win2008 with AD set to win2000 compat mode
weijun
parents:
5506
diff
changeset
|
199 |
map.put("useTicketCache", "false"); |
4b9857e483c1
6951366: kerberos login failure on win2008 with AD set to win2000 compat mode
weijun
parents:
5506
diff
changeset
|
200 |
map.put("useKeyTab", "true"); |
4b9857e483c1
6951366: kerberos login failure on win2008 with AD set to win2000 compat mode
weijun
parents:
5506
diff
changeset
|
201 |
map.put("keyTab", ktab); |
4b9857e483c1
6951366: kerberos login failure on win2008 with AD set to win2000 compat mode
weijun
parents:
5506
diff
changeset
|
202 |
map.put("principal", user); |
4b9857e483c1
6951366: kerberos login failure on win2008 with AD set to win2000 compat mode
weijun
parents:
5506
diff
changeset
|
203 |
if (storeKey) { |
4b9857e483c1
6951366: kerberos login failure on win2008 with AD set to win2000 compat mode
weijun
parents:
5506
diff
changeset
|
204 |
map.put("storeKey", "true"); |
4b9857e483c1
6951366: kerberos login failure on win2008 with AD set to win2000 compat mode
weijun
parents:
5506
diff
changeset
|
205 |
} |
4b9857e483c1
6951366: kerberos login failure on win2008 with AD set to win2000 compat mode
weijun
parents:
5506
diff
changeset
|
206 |
|
4b9857e483c1
6951366: kerberos login failure on win2008 with AD set to win2000 compat mode
weijun
parents:
5506
diff
changeset
|
207 |
krb5.initialize(out.s, null, null, map); |
4b9857e483c1
6951366: kerberos login failure on win2008 with AD set to win2000 compat mode
weijun
parents:
5506
diff
changeset
|
208 |
krb5.login(); |
4b9857e483c1
6951366: kerberos login failure on win2008 with AD set to win2000 compat mode
weijun
parents:
5506
diff
changeset
|
209 |
krb5.commit(); |
4b9857e483c1
6951366: kerberos login failure on win2008 with AD set to win2000 compat mode
weijun
parents:
5506
diff
changeset
|
210 |
return out; |
4b9857e483c1
6951366: kerberos login failure on win2008 with AD set to win2000 compat mode
weijun
parents:
5506
diff
changeset
|
211 |
} |
4b9857e483c1
6951366: kerberos login failure on win2008 with AD set to win2000 compat mode
weijun
parents:
5506
diff
changeset
|
212 |
|
4b9857e483c1
6951366: kerberos login failure on win2008 with AD set to win2000 compat mode
weijun
parents:
5506
diff
changeset
|
213 |
/** |
1454 | 214 |
* Starts as a client |
215 |
* @param target communication peer |
|
216 |
* @param mech GSS mech |
|
217 |
* @throws java.lang.Exception |
|
218 |
*/ |
|
219 |
public void startAsClient(final String target, final Oid mech) throws Exception { |
|
220 |
doAs(new Action() { |
|
221 |
@Override |
|
222 |
public byte[] run(Context me, byte[] dummy) throws Exception { |
|
223 |
GSSManager m = GSSManager.getInstance(); |
|
4336 | 224 |
me.x = (ExtendedGSSContext)m.createContext( |
225 |
target.indexOf('@') < 0 ? |
|
1454 | 226 |
m.createName(target, null) : |
227 |
m.createName(target, GSSName.NT_HOSTBASED_SERVICE), |
|
228 |
mech, |
|
229 |
cred, |
|
230 |
GSSContext.DEFAULT_LIFETIME); |
|
231 |
return null; |
|
232 |
} |
|
233 |
}, null); |
|
234 |
} |
|
235 |
||
236 |
/** |
|
237 |
* Starts as a server |
|
238 |
* @param mech GSS mech |
|
239 |
* @throws java.lang.Exception |
|
240 |
*/ |
|
241 |
public void startAsServer(final Oid mech) throws Exception { |
|
14413
e954df027393
6355584: Introduce constrained Kerberos delegation
weijun
parents:
14342
diff
changeset
|
242 |
startAsServer(null, mech, false); |
9499 | 243 |
} |
244 |
||
14413
e954df027393
6355584: Introduce constrained Kerberos delegation
weijun
parents:
14342
diff
changeset
|
245 |
public void startAsServer(final String name, final Oid mech) throws Exception { |
e954df027393
6355584: Introduce constrained Kerberos delegation
weijun
parents:
14342
diff
changeset
|
246 |
startAsServer(name, mech, false); |
e954df027393
6355584: Introduce constrained Kerberos delegation
weijun
parents:
14342
diff
changeset
|
247 |
} |
9499 | 248 |
/** |
249 |
* Starts as a server with the specified service name |
|
250 |
* @param name the service name |
|
251 |
* @param mech GSS mech |
|
252 |
* @throws java.lang.Exception |
|
253 |
*/ |
|
14413
e954df027393
6355584: Introduce constrained Kerberos delegation
weijun
parents:
14342
diff
changeset
|
254 |
public void startAsServer(final String name, final Oid mech, final boolean asInitiator) throws Exception { |
1454 | 255 |
doAs(new Action() { |
256 |
@Override |
|
257 |
public byte[] run(Context me, byte[] dummy) throws Exception { |
|
258 |
GSSManager m = GSSManager.getInstance(); |
|
14413
e954df027393
6355584: Introduce constrained Kerberos delegation
weijun
parents:
14342
diff
changeset
|
259 |
me.cred = m.createCredential( |
9499 | 260 |
name == null ? null : |
261 |
(name.indexOf('@') < 0 ? |
|
262 |
m.createName(name, null) : |
|
263 |
m.createName(name, GSSName.NT_HOSTBASED_SERVICE)), |
|
1454 | 264 |
GSSCredential.INDEFINITE_LIFETIME, |
265 |
mech, |
|
14413
e954df027393
6355584: Introduce constrained Kerberos delegation
weijun
parents:
14342
diff
changeset
|
266 |
asInitiator? |
e954df027393
6355584: Introduce constrained Kerberos delegation
weijun
parents:
14342
diff
changeset
|
267 |
GSSCredential.INITIATE_AND_ACCEPT: |
e954df027393
6355584: Introduce constrained Kerberos delegation
weijun
parents:
14342
diff
changeset
|
268 |
GSSCredential.ACCEPT_ONLY); |
e954df027393
6355584: Introduce constrained Kerberos delegation
weijun
parents:
14342
diff
changeset
|
269 |
me.x = (ExtendedGSSContext)m.createContext(me.cred); |
1454 | 270 |
return null; |
271 |
} |
|
272 |
}, null); |
|
273 |
} |
|
274 |
||
275 |
/** |
|
276 |
* Accesses the internal GSSContext object. Currently it's used for -- |
|
277 |
* |
|
278 |
* 1. calling requestXXX() before handshake |
|
279 |
* 2. accessing source name |
|
280 |
* |
|
281 |
* Note: If the application needs to do any privileged call on this |
|
282 |
* object, please use doAs(). Otherwise, it can be done directly. The |
|
283 |
* methods listed above are all non-privileged calls. |
|
284 |
* |
|
285 |
* @return the GSSContext object |
|
286 |
*/ |
|
4336 | 287 |
public ExtendedGSSContext x() { |
1454 | 288 |
return x; |
289 |
} |
|
290 |
||
291 |
/** |
|
9499 | 292 |
* Accesses the internal subject. |
293 |
* @return the subject |
|
294 |
*/ |
|
295 |
public Subject s() { |
|
296 |
return s; |
|
297 |
} |
|
298 |
||
299 |
/** |
|
16065
2d0b844bfbb6
8000653: SPNEGO tests fail at context.getDelegCred().getRemainingInitLifetime(mechOid)
weijun
parents:
15006
diff
changeset
|
300 |
* Returns the cred inside, if there is one |
2d0b844bfbb6
8000653: SPNEGO tests fail at context.getDelegCred().getRemainingInitLifetime(mechOid)
weijun
parents:
15006
diff
changeset
|
301 |
*/ |
2d0b844bfbb6
8000653: SPNEGO tests fail at context.getDelegCred().getRemainingInitLifetime(mechOid)
weijun
parents:
15006
diff
changeset
|
302 |
public GSSCredential cred() { |
2d0b844bfbb6
8000653: SPNEGO tests fail at context.getDelegCred().getRemainingInitLifetime(mechOid)
weijun
parents:
15006
diff
changeset
|
303 |
return cred; |
2d0b844bfbb6
8000653: SPNEGO tests fail at context.getDelegCred().getRemainingInitLifetime(mechOid)
weijun
parents:
15006
diff
changeset
|
304 |
} |
2d0b844bfbb6
8000653: SPNEGO tests fail at context.getDelegCred().getRemainingInitLifetime(mechOid)
weijun
parents:
15006
diff
changeset
|
305 |
|
2d0b844bfbb6
8000653: SPNEGO tests fail at context.getDelegCred().getRemainingInitLifetime(mechOid)
weijun
parents:
15006
diff
changeset
|
306 |
/** |
1454 | 307 |
* Disposes the GSSContext within |
308 |
* @throws org.ietf.jgss.GSSException |
|
309 |
*/ |
|
310 |
public void dispose() throws GSSException { |
|
311 |
x.dispose(); |
|
312 |
} |
|
313 |
||
314 |
/** |
|
315 |
* Does something using the Subject inside |
|
316 |
* @param action the action |
|
317 |
* @param in the input byte |
|
318 |
* @return the output byte |
|
319 |
* @throws java.lang.Exception |
|
320 |
*/ |
|
321 |
public byte[] doAs(final Action action, final byte[] in) throws Exception { |
|
322 |
try { |
|
323 |
return Subject.doAs(s, new PrivilegedExceptionAction<byte[]>() { |
|
324 |
||
325 |
@Override |
|
326 |
public byte[] run() throws Exception { |
|
327 |
return action.run(Context.this, in); |
|
328 |
} |
|
329 |
}); |
|
330 |
} catch (PrivilegedActionException pae) { |
|
331 |
throw pae.getException(); |
|
332 |
} |
|
333 |
} |
|
334 |
||
335 |
/** |
|
336 |
* Prints status of GSSContext and Subject |
|
337 |
* @throws java.lang.Exception |
|
338 |
*/ |
|
339 |
public void status() throws Exception { |
|
340 |
System.out.println("STATUS OF " + name.toUpperCase()); |
|
341 |
try { |
|
342 |
StringBuffer sb = new StringBuffer(); |
|
343 |
if (x.getAnonymityState()) { |
|
344 |
sb.append("anon, "); |
|
345 |
} |
|
346 |
if (x.getConfState()) { |
|
347 |
sb.append("conf, "); |
|
348 |
} |
|
349 |
if (x.getCredDelegState()) { |
|
350 |
sb.append("deleg, "); |
|
351 |
} |
|
352 |
if (x.getIntegState()) { |
|
353 |
sb.append("integ, "); |
|
354 |
} |
|
355 |
if (x.getMutualAuthState()) { |
|
356 |
sb.append("mutual, "); |
|
357 |
} |
|
358 |
if (x.getReplayDetState()) { |
|
359 |
sb.append("rep det, "); |
|
360 |
} |
|
361 |
if (x.getSequenceDetState()) { |
|
362 |
sb.append("seq det, "); |
|
363 |
} |
|
4336 | 364 |
if (x instanceof ExtendedGSSContext) { |
365 |
if (((ExtendedGSSContext)x).getDelegPolicyState()) { |
|
366 |
sb.append("deleg policy, "); |
|
367 |
} |
|
368 |
} |
|
1454 | 369 |
System.out.println("Context status of " + name + ": " + sb.toString()); |
370 |
System.out.println(x.getSrcName() + " -> " + x.getTargName()); |
|
371 |
} catch (Exception e) { |
|
372 |
;// Don't care |
|
373 |
} |
|
14413
e954df027393
6355584: Introduce constrained Kerberos delegation
weijun
parents:
14342
diff
changeset
|
374 |
if (s != null) { |
e954df027393
6355584: Introduce constrained Kerberos delegation
weijun
parents:
14342
diff
changeset
|
375 |
System.out.println("====== START SUBJECT CONTENT ====="); |
e954df027393
6355584: Introduce constrained Kerberos delegation
weijun
parents:
14342
diff
changeset
|
376 |
for (Principal p: s.getPrincipals()) { |
e954df027393
6355584: Introduce constrained Kerberos delegation
weijun
parents:
14342
diff
changeset
|
377 |
System.out.println(" Principal: " + p); |
e954df027393
6355584: Introduce constrained Kerberos delegation
weijun
parents:
14342
diff
changeset
|
378 |
} |
e954df027393
6355584: Introduce constrained Kerberos delegation
weijun
parents:
14342
diff
changeset
|
379 |
for (Object o : s.getPublicCredentials()) { |
e954df027393
6355584: Introduce constrained Kerberos delegation
weijun
parents:
14342
diff
changeset
|
380 |
System.out.println(" " + o.getClass()); |
9499 | 381 |
System.out.println(" " + o); |
1454 | 382 |
} |
14413
e954df027393
6355584: Introduce constrained Kerberos delegation
weijun
parents:
14342
diff
changeset
|
383 |
System.out.println("====== Private Credentials Set ======"); |
e954df027393
6355584: Introduce constrained Kerberos delegation
weijun
parents:
14342
diff
changeset
|
384 |
for (Object o : s.getPrivateCredentials()) { |
e954df027393
6355584: Introduce constrained Kerberos delegation
weijun
parents:
14342
diff
changeset
|
385 |
System.out.println(" " + o.getClass()); |
e954df027393
6355584: Introduce constrained Kerberos delegation
weijun
parents:
14342
diff
changeset
|
386 |
if (o instanceof KerberosTicket) { |
e954df027393
6355584: Introduce constrained Kerberos delegation
weijun
parents:
14342
diff
changeset
|
387 |
KerberosTicket kt = (KerberosTicket) o; |
e954df027393
6355584: Introduce constrained Kerberos delegation
weijun
parents:
14342
diff
changeset
|
388 |
System.out.println(" " + kt.getServer() + " for " + kt.getClient()); |
e954df027393
6355584: Introduce constrained Kerberos delegation
weijun
parents:
14342
diff
changeset
|
389 |
} else if (o instanceof KerberosKey) { |
e954df027393
6355584: Introduce constrained Kerberos delegation
weijun
parents:
14342
diff
changeset
|
390 |
KerberosKey kk = (KerberosKey) o; |
e954df027393
6355584: Introduce constrained Kerberos delegation
weijun
parents:
14342
diff
changeset
|
391 |
System.out.print(" " + kk.getKeyType() + " " + kk.getVersionNumber() + " " + kk.getAlgorithm() + " "); |
e954df027393
6355584: Introduce constrained Kerberos delegation
weijun
parents:
14342
diff
changeset
|
392 |
for (byte b : kk.getEncoded()) { |
e954df027393
6355584: Introduce constrained Kerberos delegation
weijun
parents:
14342
diff
changeset
|
393 |
System.out.printf("%02X", b & 0xff); |
e954df027393
6355584: Introduce constrained Kerberos delegation
weijun
parents:
14342
diff
changeset
|
394 |
} |
e954df027393
6355584: Introduce constrained Kerberos delegation
weijun
parents:
14342
diff
changeset
|
395 |
System.out.println(); |
e954df027393
6355584: Introduce constrained Kerberos delegation
weijun
parents:
14342
diff
changeset
|
396 |
} else if (o instanceof Map) { |
e954df027393
6355584: Introduce constrained Kerberos delegation
weijun
parents:
14342
diff
changeset
|
397 |
Map map = (Map) o; |
e954df027393
6355584: Introduce constrained Kerberos delegation
weijun
parents:
14342
diff
changeset
|
398 |
for (Object k : map.keySet()) { |
e954df027393
6355584: Introduce constrained Kerberos delegation
weijun
parents:
14342
diff
changeset
|
399 |
System.out.println(" " + k + ": " + map.get(k)); |
e954df027393
6355584: Introduce constrained Kerberos delegation
weijun
parents:
14342
diff
changeset
|
400 |
} |
e954df027393
6355584: Introduce constrained Kerberos delegation
weijun
parents:
14342
diff
changeset
|
401 |
} else { |
e954df027393
6355584: Introduce constrained Kerberos delegation
weijun
parents:
14342
diff
changeset
|
402 |
System.out.println(" " + o); |
e954df027393
6355584: Introduce constrained Kerberos delegation
weijun
parents:
14342
diff
changeset
|
403 |
} |
e954df027393
6355584: Introduce constrained Kerberos delegation
weijun
parents:
14342
diff
changeset
|
404 |
} |
e954df027393
6355584: Introduce constrained Kerberos delegation
weijun
parents:
14342
diff
changeset
|
405 |
System.out.println("====== END SUBJECT CONTENT ====="); |
1454 | 406 |
} |
3482
4aaa66ce712d
6710360: export Kerberos session key to applications
weijun
parents:
1575
diff
changeset
|
407 |
if (x != null && x instanceof ExtendedGSSContext) { |
4aaa66ce712d
6710360: export Kerberos session key to applications
weijun
parents:
1575
diff
changeset
|
408 |
if (x.isEstablished()) { |
4aaa66ce712d
6710360: export Kerberos session key to applications
weijun
parents:
1575
diff
changeset
|
409 |
ExtendedGSSContext ex = (ExtendedGSSContext)x; |
4aaa66ce712d
6710360: export Kerberos session key to applications
weijun
parents:
1575
diff
changeset
|
410 |
Key k = (Key)ex.inquireSecContext( |
4aaa66ce712d
6710360: export Kerberos session key to applications
weijun
parents:
1575
diff
changeset
|
411 |
InquireType.KRB5_GET_SESSION_KEY); |
4aaa66ce712d
6710360: export Kerberos session key to applications
weijun
parents:
1575
diff
changeset
|
412 |
if (k == null) { |
4aaa66ce712d
6710360: export Kerberos session key to applications
weijun
parents:
1575
diff
changeset
|
413 |
throw new Exception("Session key cannot be null"); |
4aaa66ce712d
6710360: export Kerberos session key to applications
weijun
parents:
1575
diff
changeset
|
414 |
} |
4aaa66ce712d
6710360: export Kerberos session key to applications
weijun
parents:
1575
diff
changeset
|
415 |
System.out.println("Session key is: " + k); |
3483
a16fce1820ef
6821190: more InquireType values for ExtendedGSSContext
weijun
parents:
3482
diff
changeset
|
416 |
boolean[] flags = (boolean[])ex.inquireSecContext( |
a16fce1820ef
6821190: more InquireType values for ExtendedGSSContext
weijun
parents:
3482
diff
changeset
|
417 |
InquireType.KRB5_GET_TKT_FLAGS); |
a16fce1820ef
6821190: more InquireType values for ExtendedGSSContext
weijun
parents:
3482
diff
changeset
|
418 |
if (flags == null) { |
a16fce1820ef
6821190: more InquireType values for ExtendedGSSContext
weijun
parents:
3482
diff
changeset
|
419 |
throw new Exception("Ticket flags cannot be null"); |
a16fce1820ef
6821190: more InquireType values for ExtendedGSSContext
weijun
parents:
3482
diff
changeset
|
420 |
} |
a16fce1820ef
6821190: more InquireType values for ExtendedGSSContext
weijun
parents:
3482
diff
changeset
|
421 |
System.out.println("Ticket flags is: " + Arrays.toString(flags)); |
a16fce1820ef
6821190: more InquireType values for ExtendedGSSContext
weijun
parents:
3482
diff
changeset
|
422 |
String authTime = (String)ex.inquireSecContext( |
a16fce1820ef
6821190: more InquireType values for ExtendedGSSContext
weijun
parents:
3482
diff
changeset
|
423 |
InquireType.KRB5_GET_AUTHTIME); |
a16fce1820ef
6821190: more InquireType values for ExtendedGSSContext
weijun
parents:
3482
diff
changeset
|
424 |
if (authTime == null) { |
a16fce1820ef
6821190: more InquireType values for ExtendedGSSContext
weijun
parents:
3482
diff
changeset
|
425 |
throw new Exception("Auth time cannot be null"); |
a16fce1820ef
6821190: more InquireType values for ExtendedGSSContext
weijun
parents:
3482
diff
changeset
|
426 |
} |
a16fce1820ef
6821190: more InquireType values for ExtendedGSSContext
weijun
parents:
3482
diff
changeset
|
427 |
System.out.println("AuthTime is: " + authTime); |
a16fce1820ef
6821190: more InquireType values for ExtendedGSSContext
weijun
parents:
3482
diff
changeset
|
428 |
if (!x.isInitiator()) { |
a16fce1820ef
6821190: more InquireType values for ExtendedGSSContext
weijun
parents:
3482
diff
changeset
|
429 |
AuthorizationDataEntry[] ad = (AuthorizationDataEntry[])ex.inquireSecContext( |
a16fce1820ef
6821190: more InquireType values for ExtendedGSSContext
weijun
parents:
3482
diff
changeset
|
430 |
InquireType.KRB5_GET_AUTHZ_DATA); |
a16fce1820ef
6821190: more InquireType values for ExtendedGSSContext
weijun
parents:
3482
diff
changeset
|
431 |
System.out.println("AuthzData is: " + Arrays.toString(ad)); |
a16fce1820ef
6821190: more InquireType values for ExtendedGSSContext
weijun
parents:
3482
diff
changeset
|
432 |
} |
3482
4aaa66ce712d
6710360: export Kerberos session key to applications
weijun
parents:
1575
diff
changeset
|
433 |
} |
4aaa66ce712d
6710360: export Kerberos session key to applications
weijun
parents:
1575
diff
changeset
|
434 |
} |
1454 | 435 |
} |
436 |
||
10696 | 437 |
public byte[] wrap(byte[] t, final boolean privacy) |
438 |
throws Exception { |
|
439 |
return doAs(new Action() { |
|
440 |
@Override |
|
441 |
public byte[] run(Context me, byte[] input) throws Exception { |
|
442 |
System.out.printf("wrap %s privacy from %s: ", privacy?"with":"without", me.name); |
|
443 |
MessageProp p1 = new MessageProp(0, privacy); |
|
444 |
byte[] out; |
|
445 |
if (usingStream) { |
|
446 |
ByteArrayOutputStream os = new ByteArrayOutputStream(); |
|
447 |
me.x.wrap(new ByteArrayInputStream(input), os, p1); |
|
448 |
out = os.toByteArray(); |
|
449 |
} else { |
|
450 |
out = me.x.wrap(input, 0, input.length, p1); |
|
451 |
} |
|
452 |
System.out.println(printProp(p1)); |
|
453 |
return out; |
|
454 |
} |
|
455 |
}, t); |
|
456 |
} |
|
457 |
||
458 |
public byte[] unwrap(byte[] t, final boolean privacy) |
|
459 |
throws Exception { |
|
460 |
return doAs(new Action() { |
|
461 |
@Override |
|
462 |
public byte[] run(Context me, byte[] input) throws Exception { |
|
463 |
System.out.printf("unwrap %s privacy from %s: ", privacy?"with":"without", me.name); |
|
464 |
MessageProp p1 = new MessageProp(0, privacy); |
|
465 |
byte[] bytes; |
|
466 |
if (usingStream) { |
|
467 |
ByteArrayOutputStream os = new ByteArrayOutputStream(); |
|
468 |
me.x.unwrap(new ByteArrayInputStream(input), os, p1); |
|
469 |
bytes = os.toByteArray(); |
|
470 |
} else { |
|
471 |
bytes = me.x.unwrap(input, 0, input.length, p1); |
|
472 |
} |
|
473 |
System.out.println(printProp(p1)); |
|
474 |
return bytes; |
|
475 |
} |
|
476 |
}, t); |
|
477 |
} |
|
478 |
||
479 |
public byte[] getMic(byte[] t) throws Exception { |
|
480 |
return doAs(new Action() { |
|
481 |
@Override |
|
482 |
public byte[] run(Context me, byte[] input) throws Exception { |
|
483 |
MessageProp p1 = new MessageProp(0, true); |
|
484 |
byte[] bytes; |
|
485 |
p1 = new MessageProp(0, true); |
|
486 |
System.out.printf("getMic from %s: ", me.name); |
|
487 |
if (usingStream) { |
|
488 |
ByteArrayOutputStream os = new ByteArrayOutputStream(); |
|
489 |
me.x.getMIC(new ByteArrayInputStream(input), os, p1); |
|
490 |
bytes = os.toByteArray(); |
|
491 |
} else { |
|
492 |
bytes = me.x.getMIC(input, 0, input.length, p1); |
|
493 |
} |
|
494 |
System.out.println(printProp(p1)); |
|
495 |
return bytes; |
|
496 |
} |
|
497 |
}, t); |
|
498 |
} |
|
499 |
||
500 |
public void verifyMic(byte[] t, final byte[] msg) throws Exception { |
|
501 |
doAs(new Action() { |
|
502 |
@Override |
|
503 |
public byte[] run(Context me, byte[] input) throws Exception { |
|
504 |
MessageProp p1 = new MessageProp(0, true); |
|
505 |
System.out.printf("verifyMic from %s: ", me.name); |
|
506 |
if (usingStream) { |
|
507 |
me.x.verifyMIC(new ByteArrayInputStream(input), |
|
508 |
new ByteArrayInputStream(msg), p1); |
|
509 |
} else { |
|
510 |
me.x.verifyMIC(input, 0, input.length, |
|
511 |
msg, 0, msg.length, |
|
512 |
p1); |
|
513 |
} |
|
514 |
System.out.println(printProp(p1)); |
|
515 |
return null; |
|
516 |
} |
|
517 |
}, t); |
|
518 |
} |
|
519 |
||
1454 | 520 |
/** |
521 |
* Transmits a message from one Context to another. The sender wraps the |
|
522 |
* message and sends it to the receiver. The receiver unwraps it, creates |
|
523 |
* a MIC of the clear text and sends it back to the sender. The sender |
|
524 |
* verifies the MIC against the message sent earlier. |
|
525 |
* @param message the message |
|
526 |
* @param s1 the sender |
|
527 |
* @param s2 the receiver |
|
528 |
* @throws java.lang.Exception If anything goes wrong |
|
529 |
*/ |
|
530 |
static public void transmit(final String message, final Context s1, |
|
531 |
final Context s2) throws Exception { |
|
532 |
final byte[] messageBytes = message.getBytes(); |
|
533 |
System.out.printf("-------------------- TRANSMIT from %s to %s------------------------\n", |
|
534 |
s1.name, s2.name); |
|
10696 | 535 |
byte[] wrapped = s1.wrap(messageBytes, true); |
536 |
byte[] unwrapped = s2.unwrap(wrapped, true); |
|
537 |
if (!Arrays.equals(messageBytes, unwrapped)) { |
|
538 |
throw new Exception("wrap/unwrap mismatch"); |
|
539 |
} |
|
540 |
byte[] mic = s2.getMic(unwrapped); |
|
541 |
s1.verifyMic(mic, messageBytes); |
|
1454 | 542 |
} |
543 |
||
544 |
/** |
|
545 |
* Returns a string description of a MessageProp object |
|
546 |
* @param prop the object |
|
547 |
* @return the description |
|
548 |
*/ |
|
549 |
static public String printProp(MessageProp prop) { |
|
550 |
StringBuffer sb = new StringBuffer(); |
|
551 |
sb.append("MessagePop: "); |
|
552 |
sb.append("QOP="+ prop.getQOP() + ", "); |
|
553 |
sb.append(prop.getPrivacy()?"privacy, ":""); |
|
554 |
sb.append(prop.isDuplicateToken()?"dup, ":""); |
|
555 |
sb.append(prop.isGapToken()?"gap, ":""); |
|
556 |
sb.append(prop.isOldToken()?"old, ":""); |
|
557 |
sb.append(prop.isUnseqToken()?"unseq, ":""); |
|
7801
814c8359b104
6975866: api/org_ietf/jgss/GSSContext/index.html#wrapUnwrapIOTest started to fail since jdk7 b102
weijun
parents:
5774
diff
changeset
|
558 |
if (prop.getMinorStatus() != 0) { |
814c8359b104
6975866: api/org_ietf/jgss/GSSContext/index.html#wrapUnwrapIOTest started to fail since jdk7 b102
weijun
parents:
5774
diff
changeset
|
559 |
sb.append(prop.getMinorString()+ "(" + prop.getMinorStatus()+")"); |
814c8359b104
6975866: api/org_ietf/jgss/GSSContext/index.html#wrapUnwrapIOTest started to fail since jdk7 b102
weijun
parents:
5774
diff
changeset
|
560 |
} |
1454 | 561 |
return sb.toString(); |
562 |
} |
|
563 |
||
14413
e954df027393
6355584: Introduce constrained Kerberos delegation
weijun
parents:
14342
diff
changeset
|
564 |
public Context impersonate(final String someone) throws Exception { |
e954df027393
6355584: Introduce constrained Kerberos delegation
weijun
parents:
14342
diff
changeset
|
565 |
try { |
e954df027393
6355584: Introduce constrained Kerberos delegation
weijun
parents:
14342
diff
changeset
|
566 |
GSSCredential creds = Subject.doAs(s, new PrivilegedExceptionAction<GSSCredential>() { |
e954df027393
6355584: Introduce constrained Kerberos delegation
weijun
parents:
14342
diff
changeset
|
567 |
@Override |
e954df027393
6355584: Introduce constrained Kerberos delegation
weijun
parents:
14342
diff
changeset
|
568 |
public GSSCredential run() throws Exception { |
e954df027393
6355584: Introduce constrained Kerberos delegation
weijun
parents:
14342
diff
changeset
|
569 |
GSSManager m = GSSManager.getInstance(); |
e954df027393
6355584: Introduce constrained Kerberos delegation
weijun
parents:
14342
diff
changeset
|
570 |
GSSName other = m.createName(someone, GSSName.NT_USER_NAME); |
e954df027393
6355584: Introduce constrained Kerberos delegation
weijun
parents:
14342
diff
changeset
|
571 |
if (Context.this.cred == null) { |
e954df027393
6355584: Introduce constrained Kerberos delegation
weijun
parents:
14342
diff
changeset
|
572 |
Context.this.cred = m.createCredential(GSSCredential.INITIATE_ONLY); |
e954df027393
6355584: Introduce constrained Kerberos delegation
weijun
parents:
14342
diff
changeset
|
573 |
} |
e954df027393
6355584: Introduce constrained Kerberos delegation
weijun
parents:
14342
diff
changeset
|
574 |
return ((ExtendedGSSCredential)Context.this.cred).impersonate(other); |
e954df027393
6355584: Introduce constrained Kerberos delegation
weijun
parents:
14342
diff
changeset
|
575 |
} |
e954df027393
6355584: Introduce constrained Kerberos delegation
weijun
parents:
14342
diff
changeset
|
576 |
}); |
e954df027393
6355584: Introduce constrained Kerberos delegation
weijun
parents:
14342
diff
changeset
|
577 |
Context out = new Context(); |
e954df027393
6355584: Introduce constrained Kerberos delegation
weijun
parents:
14342
diff
changeset
|
578 |
out.s = s; |
e954df027393
6355584: Introduce constrained Kerberos delegation
weijun
parents:
14342
diff
changeset
|
579 |
out.cred = creds; |
e954df027393
6355584: Introduce constrained Kerberos delegation
weijun
parents:
14342
diff
changeset
|
580 |
out.name = name + " as " + out.cred.getName().toString(); |
e954df027393
6355584: Introduce constrained Kerberos delegation
weijun
parents:
14342
diff
changeset
|
581 |
return out; |
e954df027393
6355584: Introduce constrained Kerberos delegation
weijun
parents:
14342
diff
changeset
|
582 |
} catch (PrivilegedActionException pae) { |
e954df027393
6355584: Introduce constrained Kerberos delegation
weijun
parents:
14342
diff
changeset
|
583 |
throw pae.getException(); |
e954df027393
6355584: Introduce constrained Kerberos delegation
weijun
parents:
14342
diff
changeset
|
584 |
} |
e954df027393
6355584: Introduce constrained Kerberos delegation
weijun
parents:
14342
diff
changeset
|
585 |
} |
e954df027393
6355584: Introduce constrained Kerberos delegation
weijun
parents:
14342
diff
changeset
|
586 |
|
11526 | 587 |
public byte[] take(final byte[] in) throws Exception { |
588 |
return doAs(new Action() { |
|
589 |
@Override |
|
590 |
public byte[] run(Context me, byte[] input) throws Exception { |
|
591 |
if (me.x.isEstablished()) { |
|
592 |
System.out.println(name + " side established"); |
|
593 |
if (input != null) { |
|
594 |
throw new Exception("Context established but " + |
|
595 |
"still receive token at " + name); |
|
596 |
} |
|
597 |
return null; |
|
598 |
} else { |
|
599 |
if (me.x.isInitiator()) { |
|
14413
e954df027393
6355584: Introduce constrained Kerberos delegation
weijun
parents:
14342
diff
changeset
|
600 |
System.out.println(name + " call initSecContext"); |
11526 | 601 |
return me.x.initSecContext(input, 0, input.length); |
602 |
} else { |
|
14413
e954df027393
6355584: Introduce constrained Kerberos delegation
weijun
parents:
14342
diff
changeset
|
603 |
System.out.println(name + " call acceptSecContext"); |
11526 | 604 |
return me.x.acceptSecContext(input, 0, input.length); |
605 |
} |
|
606 |
} |
|
607 |
} |
|
608 |
}, in); |
|
609 |
} |
|
610 |
||
1454 | 611 |
/** |
612 |
* Handshake (security context establishment process) between two Contexts |
|
613 |
* @param c the initiator |
|
614 |
* @param s the acceptor |
|
615 |
* @throws java.lang.Exception |
|
616 |
*/ |
|
617 |
static public void handshake(final Context c, final Context s) throws Exception { |
|
618 |
byte[] t = new byte[0]; |
|
11526 | 619 |
while (!c.x.isEstablished() || !s.x.isEstablished()) { |
620 |
t = c.take(t); |
|
621 |
t = s.take(t); |
|
1454 | 622 |
} |
623 |
} |
|
624 |
} |