1 /*
2 * Copyright (c) 2000, 2012, 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
73 * }
74 * }</pre>
75 *
76 * <p>
77 * This definition reflects the Network Working Group RFC 4120
78 * specification available at
79 * <a href="http://www.ietf.org/rfc/rfc4120.txt">
80 * http://www.ietf.org/rfc/rfc4120.txt</a>.
81 */
82
83 public class KRBError implements java.io.Serializable {
84 static final long serialVersionUID = 3643809337475284503L;
85
86 private int pvno;
87 private int msgType;
88 private KerberosTime cTime; //optional
89 private Integer cuSec; //optional
90 private KerberosTime sTime;
91 private Integer suSec;
92 private int errorCode;
93 private PrincipalName cname; //optional
94 private PrincipalName sname;
95 private String eText; //optional
96 private byte[] eData; //optional
97 private Checksum eCksum; //optional
98
99 private PAData[] pa; // PA-DATA in eData
100
101 private static boolean DEBUG = Krb5.DEBUG;
102
103 private void readObject(ObjectInputStream is)
104 throws IOException, ClassNotFoundException {
105 try {
106 init(new DerValue((byte[])is.readObject()));
107 parseEData(eData);
108 } catch (Exception e) {
109 throw new IOException(e);
110 }
111 }
112
121
122 public KRBError(
123 APOptions new_apOptions,
124 KerberosTime new_cTime,
125 Integer new_cuSec,
126 KerberosTime new_sTime,
127 Integer new_suSec,
128 int new_errorCode,
129 PrincipalName new_cname,
130 PrincipalName new_sname,
131 String new_eText,
132 byte[] new_eData
133 ) throws IOException, Asn1Exception {
134 pvno = Krb5.PVNO;
135 msgType = Krb5.KRB_ERROR;
136 cTime = new_cTime;
137 cuSec = new_cuSec;
138 sTime = new_sTime;
139 suSec = new_suSec;
140 errorCode = new_errorCode;
141 cname = new_cname;
142 sname = new_sname;
143 eText = new_eText;
144 eData = new_eData;
145
146 parseEData(eData);
147 }
148
149 public KRBError(
150 APOptions new_apOptions,
151 KerberosTime new_cTime,
152 Integer new_cuSec,
153 KerberosTime new_sTime,
154 Integer new_suSec,
155 int new_errorCode,
156 PrincipalName new_cname,
157 PrincipalName new_sname,
158 String new_eText,
159 byte[] new_eData,
160 Checksum new_eCksum
161 ) throws IOException, Asn1Exception {
162 pvno = Krb5.PVNO;
163 msgType = Krb5.KRB_ERROR;
164 cTime = new_cTime;
165 cuSec = new_cuSec;
166 sTime = new_sTime;
167 suSec = new_suSec;
168 errorCode = new_errorCode;
169 cname = new_cname;
170 sname = new_sname;
171 eText = new_eText;
172 eData = new_eData;
173 eCksum = new_eCksum;
174
175 parseEData(eData);
176 }
177
178 public KRBError(byte[] data) throws Asn1Exception,
179 RealmException, KrbApErrException, IOException {
180 init(new DerValue(data));
181 parseEData(eData);
182 }
183
184 public KRBError(DerValue encoding) throws Asn1Exception,
185 RealmException, KrbApErrException, IOException {
186 init(encoding);
187 showDebug();
188 parseEData(eData);
245 /**
246 * Try parsing the data as a sequence of PA-DATA.
247 * @param data the data block
248 */
249 private void parsePAData(byte[] data)
250 throws IOException, Asn1Exception {
251 DerValue derPA = new DerValue(data);
252 List<PAData> paList = new ArrayList<>();
253 while (derPA.data.available() > 0) {
254 // read the PA-DATA
255 DerValue tmp = derPA.data.getDerValue();
256 PAData pa_data = new PAData(tmp);
257 paList.add(pa_data);
258 if (DEBUG) {
259 System.out.println(pa_data);
260 }
261 }
262 pa = paList.toArray(new PAData[paList.size()]);
263 }
264
265 public final KerberosTime getServerTime() {
266 return sTime;
267 }
268
269 public final KerberosTime getClientTime() {
270 return cTime;
271 }
272
273 public final Integer getServerMicroSeconds() {
274 return suSec;
275 }
276
277 public final Integer getClientMicroSeconds() {
278 return cuSec;
279 }
280
281 public final int getErrorCode() {
282 return errorCode;
283 }
284
332 throw new Asn1Exception(Krb5.ASN1_BAD_ID);
333 }
334
335 cTime = KerberosTime.parse(der.getData(), (byte)0x02, true);
336 if ((der.getData().peekByte() & 0x1F) == 0x03) {
337 subDer = der.getData().getDerValue();
338 cuSec = subDer.getData().getBigInteger().intValue();
339 }
340 else cuSec = null;
341 sTime = KerberosTime.parse(der.getData(), (byte)0x04, false);
342 subDer = der.getData().getDerValue();
343 if ((subDer.getTag() & (byte)0x1F) == (byte)0x05) {
344 suSec = subDer.getData().getBigInteger().intValue();
345 }
346 else throw new Asn1Exception(Krb5.ASN1_BAD_ID);
347 subDer = der.getData().getDerValue();
348 if ((subDer.getTag() & (byte)0x1F) == (byte)0x06) {
349 errorCode = subDer.getData().getBigInteger().intValue();
350 }
351 else throw new Asn1Exception(Krb5.ASN1_BAD_ID);
352 Realm crealm = Realm.parse(der.getData(), (byte)0x07, true);
353 cname = PrincipalName.parse(der.getData(), (byte)0x08, true, crealm);
354 Realm realm = Realm.parse(der.getData(), (byte)0x09, false);
355 sname = PrincipalName.parse(der.getData(), (byte)0x0A, false, realm);
356 eText = null;
357 eData = null;
358 eCksum = null;
359 if (der.getData().available() >0) {
360 if ((der.getData().peekByte() & 0x1F) == 0x0B) {
361 subDer = der.getData().getDerValue();
362 eText = new KerberosString(subDer.getData().getDerValue())
363 .toString();
364 }
365 }
366 if (der.getData().available() >0) {
367 if ((der.getData().peekByte() & 0x1F) == 0x0C) {
368 subDer = der.getData().getDerValue();
369 eData = subDer.getData().getOctetString();
370 }
371 }
372 if (der.getData().available() >0) {
376 throw new Asn1Exception(Krb5.ASN1_BAD_ID);
377 }
378
379 /**
380 * For debug use only
381 */
382 private void showDebug() {
383 if (DEBUG) {
384 System.out.println(">>>KRBError:");
385 if (cTime != null)
386 System.out.println("\t cTime is " + cTime.toDate().toString() + " " + cTime.toDate().getTime());
387 if (cuSec != null) {
388 System.out.println("\t cuSec is " + cuSec.intValue());
389 }
390
391 System.out.println("\t sTime is " + sTime.toDate().toString
392 () + " " + sTime.toDate().getTime());
393 System.out.println("\t suSec is " + suSec);
394 System.out.println("\t error code is " + errorCode);
395 System.out.println("\t error Message is " + Krb5.getErrorMessage(errorCode));
396 if (cname != null) {
397 System.out.println("\t cname is " + cname.toString());
398 }
399 if (sname != null) {
400 System.out.println("\t sname is " + sname.toString());
401 }
402 if (eData != null) {
403 System.out.println("\t eData provided.");
404 }
405 if (eCksum != null) {
406 System.out.println("\t checksum provided.");
407 }
408 System.out.println("\t msgType is " + msgType);
409 }
410 }
411
412 /**
413 * Encodes an KRBError object.
414 * @return the byte array of encoded KRBError object.
415 * @exception Asn1Exception if an error occurs while decoding an ASN1 encoded data.
425 temp.putInteger(BigInteger.valueOf(msgType));
426 bytes.write(DerValue.createTag(DerValue.TAG_CONTEXT, true, (byte)0x01), temp);
427
428 if (cTime != null) {
429 bytes.write(DerValue.createTag(DerValue.TAG_CONTEXT, true, (byte)0x02), cTime.asn1Encode());
430 }
431 if (cuSec != null) {
432 temp = new DerOutputStream();
433 temp.putInteger(BigInteger.valueOf(cuSec.intValue()));
434 bytes.write(DerValue.createTag(DerValue.TAG_CONTEXT, true, (byte)0x03), temp);
435 }
436
437 bytes.write(DerValue.createTag(DerValue.TAG_CONTEXT, true, (byte)0x04), sTime.asn1Encode());
438 temp = new DerOutputStream();
439 temp.putInteger(BigInteger.valueOf(suSec.intValue()));
440 bytes.write(DerValue.createTag(DerValue.TAG_CONTEXT, true, (byte)0x05), temp);
441 temp = new DerOutputStream();
442 temp.putInteger(BigInteger.valueOf(errorCode));
443 bytes.write(DerValue.createTag(DerValue.TAG_CONTEXT, true, (byte)0x06), temp);
444
445 if (cname != null) {
446 bytes.write(DerValue.createTag(DerValue.TAG_CONTEXT, true, (byte)0x07), cname.getRealm().asn1Encode());
447 bytes.write(DerValue.createTag(DerValue.TAG_CONTEXT, true, (byte)0x08), cname.asn1Encode());
448 }
449
450 bytes.write(DerValue.createTag(DerValue.TAG_CONTEXT, true, (byte)0x09), sname.getRealm().asn1Encode());
451 bytes.write(DerValue.createTag(DerValue.TAG_CONTEXT, true, (byte)0x0A), sname.asn1Encode());
452
453 if (eText != null) {
454 temp = new DerOutputStream();
455 temp.putDerValue(new KerberosString(eText).toDerValue());
456 bytes.write(DerValue.createTag(DerValue.TAG_CONTEXT, true, (byte)0x0B), temp);
457 }
458 if (eData != null) {
459 temp = new DerOutputStream();
460 temp.putOctetString(eData);
461 bytes.write(DerValue.createTag(DerValue.TAG_CONTEXT, true, (byte)0x0C), temp);
462 }
463 if (eCksum != null) {
464 bytes.write(DerValue.createTag(DerValue.TAG_CONTEXT, true, (byte)0x0D), eCksum.asn1Encode());
465 }
466
471 return bytes.toByteArray();
472 }
473
474 @Override public boolean equals(Object obj) {
475 if (this == obj) {
476 return true;
477 }
478
479 if (!(obj instanceof KRBError)) {
480 return false;
481 }
482
483 KRBError other = (KRBError)obj;
484 return pvno == other.pvno &&
485 msgType == other.msgType &&
486 isEqual(cTime, other.cTime) &&
487 isEqual(cuSec, other.cuSec) &&
488 isEqual(sTime, other.sTime) &&
489 isEqual(suSec, other.suSec) &&
490 errorCode == other.errorCode &&
491 isEqual(cname, other.cname) &&
492 isEqual(sname, other.sname) &&
493 isEqual(eText, other.eText) &&
494 java.util.Arrays.equals(eData, other.eData) &&
495 isEqual(eCksum, other.eCksum);
496 }
497
498 private static boolean isEqual(Object a, Object b) {
499 return (a == null)?(b == null):(a.equals(b));
500 }
501
502 @Override public int hashCode() {
503 int result = 17;
504 result = 37 * result + pvno;
505 result = 37 * result + msgType;
506 if (cTime != null) result = 37 * result + cTime.hashCode();
507 if (cuSec != null) result = 37 * result + cuSec.hashCode();
508 if (sTime != null) result = 37 * result + sTime.hashCode();
509 if (suSec != null) result = 37 * result + suSec.hashCode();
510 result = 37 * result + errorCode;
511 if (cname != null) result = 37 * result + cname.hashCode();
512 if (sname != null) result = 37 * result + sname.hashCode();
513 if (eText != null) result = 37 * result + eText.hashCode();
514 result = 37 * result + Arrays.hashCode(eData);
515 if (eCksum != null) result = 37 * result + eCksum.hashCode();
516 return result;
517 }
518 }
|
1 /*
2 * Copyright (c) 2000, 2018, 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
73 * }
74 * }</pre>
75 *
76 * <p>
77 * This definition reflects the Network Working Group RFC 4120
78 * specification available at
79 * <a href="http://www.ietf.org/rfc/rfc4120.txt">
80 * http://www.ietf.org/rfc/rfc4120.txt</a>.
81 */
82
83 public class KRBError implements java.io.Serializable {
84 static final long serialVersionUID = 3643809337475284503L;
85
86 private int pvno;
87 private int msgType;
88 private KerberosTime cTime; //optional
89 private Integer cuSec; //optional
90 private KerberosTime sTime;
91 private Integer suSec;
92 private int errorCode;
93 private Realm crealm; //optional
94 private PrincipalName cname; //optional
95 private PrincipalName sname;
96 private String eText; //optional
97 private byte[] eData; //optional
98 private Checksum eCksum; //optional
99
100 private PAData[] pa; // PA-DATA in eData
101
102 private static boolean DEBUG = Krb5.DEBUG;
103
104 private void readObject(ObjectInputStream is)
105 throws IOException, ClassNotFoundException {
106 try {
107 init(new DerValue((byte[])is.readObject()));
108 parseEData(eData);
109 } catch (Exception e) {
110 throw new IOException(e);
111 }
112 }
113
122
123 public KRBError(
124 APOptions new_apOptions,
125 KerberosTime new_cTime,
126 Integer new_cuSec,
127 KerberosTime new_sTime,
128 Integer new_suSec,
129 int new_errorCode,
130 PrincipalName new_cname,
131 PrincipalName new_sname,
132 String new_eText,
133 byte[] new_eData
134 ) throws IOException, Asn1Exception {
135 pvno = Krb5.PVNO;
136 msgType = Krb5.KRB_ERROR;
137 cTime = new_cTime;
138 cuSec = new_cuSec;
139 sTime = new_sTime;
140 suSec = new_suSec;
141 errorCode = new_errorCode;
142 crealm = new_cname.getRealm();
143 cname = new_cname;
144 sname = new_sname;
145 eText = new_eText;
146 eData = new_eData;
147
148 parseEData(eData);
149 }
150
151 public KRBError(
152 APOptions new_apOptions,
153 KerberosTime new_cTime,
154 Integer new_cuSec,
155 KerberosTime new_sTime,
156 Integer new_suSec,
157 int new_errorCode,
158 PrincipalName new_cname,
159 PrincipalName new_sname,
160 String new_eText,
161 byte[] new_eData,
162 Checksum new_eCksum
163 ) throws IOException, Asn1Exception {
164 pvno = Krb5.PVNO;
165 msgType = Krb5.KRB_ERROR;
166 cTime = new_cTime;
167 cuSec = new_cuSec;
168 sTime = new_sTime;
169 suSec = new_suSec;
170 errorCode = new_errorCode;
171 crealm = new_cname.getRealm();
172 cname = new_cname;
173 sname = new_sname;
174 eText = new_eText;
175 eData = new_eData;
176 eCksum = new_eCksum;
177
178 parseEData(eData);
179 }
180
181 public KRBError(byte[] data) throws Asn1Exception,
182 RealmException, KrbApErrException, IOException {
183 init(new DerValue(data));
184 parseEData(eData);
185 }
186
187 public KRBError(DerValue encoding) throws Asn1Exception,
188 RealmException, KrbApErrException, IOException {
189 init(encoding);
190 showDebug();
191 parseEData(eData);
248 /**
249 * Try parsing the data as a sequence of PA-DATA.
250 * @param data the data block
251 */
252 private void parsePAData(byte[] data)
253 throws IOException, Asn1Exception {
254 DerValue derPA = new DerValue(data);
255 List<PAData> paList = new ArrayList<>();
256 while (derPA.data.available() > 0) {
257 // read the PA-DATA
258 DerValue tmp = derPA.data.getDerValue();
259 PAData pa_data = new PAData(tmp);
260 paList.add(pa_data);
261 if (DEBUG) {
262 System.out.println(pa_data);
263 }
264 }
265 pa = paList.toArray(new PAData[paList.size()]);
266 }
267
268 public final Realm getClientRealm() {
269 return crealm;
270 }
271
272 public final KerberosTime getServerTime() {
273 return sTime;
274 }
275
276 public final KerberosTime getClientTime() {
277 return cTime;
278 }
279
280 public final Integer getServerMicroSeconds() {
281 return suSec;
282 }
283
284 public final Integer getClientMicroSeconds() {
285 return cuSec;
286 }
287
288 public final int getErrorCode() {
289 return errorCode;
290 }
291
339 throw new Asn1Exception(Krb5.ASN1_BAD_ID);
340 }
341
342 cTime = KerberosTime.parse(der.getData(), (byte)0x02, true);
343 if ((der.getData().peekByte() & 0x1F) == 0x03) {
344 subDer = der.getData().getDerValue();
345 cuSec = subDer.getData().getBigInteger().intValue();
346 }
347 else cuSec = null;
348 sTime = KerberosTime.parse(der.getData(), (byte)0x04, false);
349 subDer = der.getData().getDerValue();
350 if ((subDer.getTag() & (byte)0x1F) == (byte)0x05) {
351 suSec = subDer.getData().getBigInteger().intValue();
352 }
353 else throw new Asn1Exception(Krb5.ASN1_BAD_ID);
354 subDer = der.getData().getDerValue();
355 if ((subDer.getTag() & (byte)0x1F) == (byte)0x06) {
356 errorCode = subDer.getData().getBigInteger().intValue();
357 }
358 else throw new Asn1Exception(Krb5.ASN1_BAD_ID);
359 crealm = Realm.parse(der.getData(), (byte)0x07, true);
360 cname = PrincipalName.parse(der.getData(), (byte)0x08, true, crealm);
361 Realm realm = Realm.parse(der.getData(), (byte)0x09, false);
362 sname = PrincipalName.parse(der.getData(), (byte)0x0A, false, realm);
363 eText = null;
364 eData = null;
365 eCksum = null;
366 if (der.getData().available() >0) {
367 if ((der.getData().peekByte() & 0x1F) == 0x0B) {
368 subDer = der.getData().getDerValue();
369 eText = new KerberosString(subDer.getData().getDerValue())
370 .toString();
371 }
372 }
373 if (der.getData().available() >0) {
374 if ((der.getData().peekByte() & 0x1F) == 0x0C) {
375 subDer = der.getData().getDerValue();
376 eData = subDer.getData().getOctetString();
377 }
378 }
379 if (der.getData().available() >0) {
383 throw new Asn1Exception(Krb5.ASN1_BAD_ID);
384 }
385
386 /**
387 * For debug use only
388 */
389 private void showDebug() {
390 if (DEBUG) {
391 System.out.println(">>>KRBError:");
392 if (cTime != null)
393 System.out.println("\t cTime is " + cTime.toDate().toString() + " " + cTime.toDate().getTime());
394 if (cuSec != null) {
395 System.out.println("\t cuSec is " + cuSec.intValue());
396 }
397
398 System.out.println("\t sTime is " + sTime.toDate().toString
399 () + " " + sTime.toDate().getTime());
400 System.out.println("\t suSec is " + suSec);
401 System.out.println("\t error code is " + errorCode);
402 System.out.println("\t error Message is " + Krb5.getErrorMessage(errorCode));
403 if (crealm != null) {
404 System.out.println("\t crealm is " + crealm.toString());
405 }
406 if (cname != null) {
407 System.out.println("\t cname is " + cname.toString());
408 }
409 if (sname != null) {
410 System.out.println("\t sname is " + sname.toString());
411 }
412 if (eData != null) {
413 System.out.println("\t eData provided.");
414 }
415 if (eCksum != null) {
416 System.out.println("\t checksum provided.");
417 }
418 System.out.println("\t msgType is " + msgType);
419 }
420 }
421
422 /**
423 * Encodes an KRBError object.
424 * @return the byte array of encoded KRBError object.
425 * @exception Asn1Exception if an error occurs while decoding an ASN1 encoded data.
435 temp.putInteger(BigInteger.valueOf(msgType));
436 bytes.write(DerValue.createTag(DerValue.TAG_CONTEXT, true, (byte)0x01), temp);
437
438 if (cTime != null) {
439 bytes.write(DerValue.createTag(DerValue.TAG_CONTEXT, true, (byte)0x02), cTime.asn1Encode());
440 }
441 if (cuSec != null) {
442 temp = new DerOutputStream();
443 temp.putInteger(BigInteger.valueOf(cuSec.intValue()));
444 bytes.write(DerValue.createTag(DerValue.TAG_CONTEXT, true, (byte)0x03), temp);
445 }
446
447 bytes.write(DerValue.createTag(DerValue.TAG_CONTEXT, true, (byte)0x04), sTime.asn1Encode());
448 temp = new DerOutputStream();
449 temp.putInteger(BigInteger.valueOf(suSec.intValue()));
450 bytes.write(DerValue.createTag(DerValue.TAG_CONTEXT, true, (byte)0x05), temp);
451 temp = new DerOutputStream();
452 temp.putInteger(BigInteger.valueOf(errorCode));
453 bytes.write(DerValue.createTag(DerValue.TAG_CONTEXT, true, (byte)0x06), temp);
454
455 if (crealm != null) {
456 bytes.write(DerValue.createTag(DerValue.TAG_CONTEXT, true, (byte)0x07), crealm.asn1Encode());
457 }
458 if (cname != null) {
459 bytes.write(DerValue.createTag(DerValue.TAG_CONTEXT, true, (byte)0x08), cname.asn1Encode());
460 }
461
462 bytes.write(DerValue.createTag(DerValue.TAG_CONTEXT, true, (byte)0x09), sname.getRealm().asn1Encode());
463 bytes.write(DerValue.createTag(DerValue.TAG_CONTEXT, true, (byte)0x0A), sname.asn1Encode());
464
465 if (eText != null) {
466 temp = new DerOutputStream();
467 temp.putDerValue(new KerberosString(eText).toDerValue());
468 bytes.write(DerValue.createTag(DerValue.TAG_CONTEXT, true, (byte)0x0B), temp);
469 }
470 if (eData != null) {
471 temp = new DerOutputStream();
472 temp.putOctetString(eData);
473 bytes.write(DerValue.createTag(DerValue.TAG_CONTEXT, true, (byte)0x0C), temp);
474 }
475 if (eCksum != null) {
476 bytes.write(DerValue.createTag(DerValue.TAG_CONTEXT, true, (byte)0x0D), eCksum.asn1Encode());
477 }
478
483 return bytes.toByteArray();
484 }
485
486 @Override public boolean equals(Object obj) {
487 if (this == obj) {
488 return true;
489 }
490
491 if (!(obj instanceof KRBError)) {
492 return false;
493 }
494
495 KRBError other = (KRBError)obj;
496 return pvno == other.pvno &&
497 msgType == other.msgType &&
498 isEqual(cTime, other.cTime) &&
499 isEqual(cuSec, other.cuSec) &&
500 isEqual(sTime, other.sTime) &&
501 isEqual(suSec, other.suSec) &&
502 errorCode == other.errorCode &&
503 isEqual(crealm, other.crealm) &&
504 isEqual(cname, other.cname) &&
505 isEqual(sname, other.sname) &&
506 isEqual(eText, other.eText) &&
507 java.util.Arrays.equals(eData, other.eData) &&
508 isEqual(eCksum, other.eCksum);
509 }
510
511 private static boolean isEqual(Object a, Object b) {
512 return (a == null)?(b == null):(a.equals(b));
513 }
514
515 @Override public int hashCode() {
516 int result = 17;
517 result = 37 * result + pvno;
518 result = 37 * result + msgType;
519 if (cTime != null) result = 37 * result + cTime.hashCode();
520 if (cuSec != null) result = 37 * result + cuSec.hashCode();
521 if (sTime != null) result = 37 * result + sTime.hashCode();
522 if (suSec != null) result = 37 * result + suSec.hashCode();
523 result = 37 * result + errorCode;
524 if (crealm != null) result = 37 * result + crealm.hashCode();
525 if (cname != null) result = 37 * result + cname.hashCode();
526 if (sname != null) result = 37 * result + sname.hashCode();
527 if (eText != null) result = 37 * result + eText.hashCode();
528 result = 37 * result + Arrays.hashCode(eData);
529 if (eCksum != null) result = 37 * result + eCksum.hashCode();
530 return result;
531 }
532 }
|