/*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation. Oracle designates this
* particular file as subject to the "Classpath" exception as provided
* by Oracle in the LICENSE file that accompanied this code.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
/*
*
* (C) Copyright IBM Corp. 1999 All Rights Reserved.
* Copyright 1997 The Open Group Research Institute. All rights reserved.
*/
/**
* Implements the ASN.1 KRBError type.
*
* <xmp>
* KRB-ERROR ::= [APPLICATION 30] SEQUENCE {
* pvno [0] INTEGER (5),
* msg-type [1] INTEGER (30),
* ctime [2] KerberosTime OPTIONAL,
* cusec [3] Microseconds OPTIONAL,
* stime [4] KerberosTime,
* susec [5] Microseconds,
* error-code [6] Int32,
* crealm [7] Realm OPTIONAL,
* cname [8] PrincipalName OPTIONAL,
* realm [9] Realm -- service realm --,
* sname [10] PrincipalName -- service name --,
* e-text [11] KerberosString OPTIONAL,
* e-data [12] OCTET STRING OPTIONAL
* }
*
* METHOD-DATA ::= SEQUENCE OF PA-DATA
*
* TYPED-DATA ::= SEQUENCE SIZE (1..MAX) OF SEQUENCE {
* data-type [0] Int32,
* data-value [1] OCTET STRING OPTIONAL
* }
* </xmp>
*
* <p>
* This definition reflects the Network Working Group RFC 4120
* specification available at
* <a href="http://www.ietf.org/rfc/rfc4120.txt">
*/
private int pvno;
private int msgType;
private int errorCode;
throws IOException, ClassNotFoundException {
try {
} catch (Exception e) {
throw new IOException(e);
}
}
throws IOException {
try {
} catch (Exception e) {
throw new IOException(e);
}
}
public KRBError(
int new_errorCode,
byte[] new_eData
) throws IOException, Asn1Exception {
crealm = new_crealm;
}
public KRBError(
int new_errorCode,
byte[] new_eData,
) throws IOException, Asn1Exception {
crealm = new_crealm;
eCksum = new_eCksum;
}
}
showDebug();
}
/*
* Attention:
*
* According to RFC 4120, e-data field in a KRB-ERROR message is
* a METHOD-DATA when errorCode is KDC_ERR_PREAUTH_REQUIRED,
* and application-specific otherwise (The RFC suggests using
* TYPED-DATA).
*
* Hence, the ideal procedure to parse e-data should look like:
*
* if (errorCode is KDC_ERR_PREAUTH_REQUIRED) {
* parse as METHOD-DATA
* } else {
* try parsing as TYPED-DATA
* }
*
* Unfortunately, we know that some implementations also use the
* METHOD-DATA format for errorcode KDC_ERR_PREAUTH_FAILED, and
* do not use the TYPED-DATA for other errorcodes (say,
* KDC_ERR_CLIENT_REVOKED).
*/
// parse the edata field
return;
}
// We need to parse eData as METHOD-DATA for both errorcodes.
try {
// RFC 4120 does not guarantee that eData is METHOD-DATA when
// errorCode is KDC_ERR_PREAUTH_FAILED. Therefore, the parse
// may fail.
} catch (Exception e) {
if (DEBUG) {
}
"Unable to parse eData field of KRB-ERROR");
throw ioe;
}
} else {
if (DEBUG) {
}
}
}
/**
* Try parsing the data as a sequence of PA-DATA.
* @param data the data block
*/
throws IOException, Asn1Exception {
// read the PA-DATA
if (DEBUG) {
}
}
}
return sTime;
}
return cTime;
}
return suSec;
}
return cuSec;
}
public final int getErrorCode() {
return errorCode;
}
// access pre-auth info
return pa;
}
return eText;
}
/**
* Initializes a KRBError object.
* @param encoding a DER-encoded data.
* @exception Asn1Exception if an error occurs while decoding an ASN1 encoded data.
* @exception IOException if an I/O error occurs while reading encoded data.
* @exception KrbApErrException if the value read from the DER-encoded data
* stream does not match the pre-defined value.
* @exception RealmException if an error occurs while parsing a Realm object.
*/
|| (encoding.isApplication() != true)
|| (encoding.isConstructed() != true)) {
}
}
} else {
}
}
} else {
}
}
}
}
.toString();
}
}
}
}
}
}
/**
* For debug use only
*/
private void showDebug() {
if (DEBUG) {
}
}
}
}
}
}
}
}
}
/**
* Encodes an KRBError object.
* @return the byte array of encoded KRBError object.
* @exception Asn1Exception if an error occurs while decoding an ASN1 encoded data.
* @exception IOException if an I/O error occurs while reading encoded data.
*/
temp = new DerOutputStream();
}
temp = new DerOutputStream();
}
temp = new DerOutputStream();
temp = new DerOutputStream();
}
}
temp = new DerOutputStream();
}
temp = new DerOutputStream();
}
}
temp = new DerOutputStream();
bytes = new DerOutputStream();
return bytes.toByteArray();
}
if (this == obj) {
return true;
}
return false;
}
}
}
int result = 17;
return result;
}
}