equal
deleted
inserted
replaced
1 /* |
1 /* |
2 * Copyright (c) 2000, 2010, Oracle and/or its affiliates. All rights reserved. |
2 * Copyright (c) 2000, 2011, Oracle and/or its affiliates. All rights reserved. |
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
4 * |
4 * |
5 * This code is free software; you can redistribute it and/or modify it |
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 |
6 * under the terms of the GNU General Public License version 2 only, as |
7 * published by the Free Software Foundation. Oracle designates this |
7 * published by the Free Software Foundation. Oracle designates this |
208 */ |
208 */ |
209 // XXX Passing in Checksum is not required. byte[] can |
209 // XXX Passing in Checksum is not required. byte[] can |
210 // be passed in if this checksum type denotes a |
210 // be passed in if this checksum type denotes a |
211 // raw_checksum. In that case, make Checksum class krb5 |
211 // raw_checksum. In that case, make Checksum class krb5 |
212 // internal. |
212 // internal. |
213 public OverloadedChecksum(Krb5Context context, |
213 public OverloadedChecksum(Krb5Context context, Checksum checksum, |
214 Checksum checksum, EncryptionKey key) |
214 EncryptionKey key, EncryptionKey subKey) |
215 throws GSSException, KrbException, IOException { |
215 throws GSSException, KrbException, IOException { |
216 |
216 |
217 int pos = 0; |
217 int pos = 0; |
218 |
218 |
219 if (checksum == null) { |
219 if (checksum == null) { |
281 if (useNullKey(cipherHelper)) { |
281 if (useNullKey(cipherHelper)) { |
282 delegCreds = |
282 delegCreds = |
283 new KrbCred(credBytes, EncryptionKey.NULL_KEY). |
283 new KrbCred(credBytes, EncryptionKey.NULL_KEY). |
284 getDelegatedCreds()[0]; |
284 getDelegatedCreds()[0]; |
285 } else { |
285 } else { |
286 delegCreds = |
286 KrbCred cred; |
287 new KrbCred(credBytes, key). |
287 try { |
288 getDelegatedCreds()[0]; |
288 cred = new KrbCred(credBytes, key); |
|
289 } catch (KrbException e) { |
|
290 if (subKey != null) { |
|
291 cred = new KrbCred(credBytes, subKey); |
|
292 } else { |
|
293 throw e; |
|
294 } |
|
295 } |
|
296 delegCreds = cred.getDelegatedCreds()[0]; |
289 } |
297 } |
290 } |
298 } |
291 } |
299 } |
292 |
300 |
293 // check if KRB-CRED message should use NULL_KEY for encryption |
301 // check if KRB-CRED message should use NULL_KEY for encryption |