// Copyright 1997 The Open Group Research Institute.  All rights reserved.

package krb5.lib;

import krb5.lib.asn1.*;

/**
 * Encrypted TGS response part
 */
public class EncTGSRepPart extends EncKDCRepPart {

	/**
	 * Class constructor
	 *
	 * @param new_key is of type EncryptionKey
	 * @param new_lastReq is of type LastReq
	 * @param new_nonce is of type int
	 * @param new_keyExpiration is of type KerberosTime
	 * @param new_flags is of type TicketFlags
	 * @param new_authtime is of type KerberosTime
	 * @param new_starttime is of type KerberosTime
	 * @param new_endtime is of type KerberosTime
	 * @param new_renewTill is of type KerberosTime
	 * @param new_srealm is of type Realm
	 * @param new_sname is of type PrincipalName
	 * @param new_caddr is of type HostAddresses
	 * @see krb5.lib.EncryptionKey
	 * @see krb5.lib.LastReq
	 * @see krb5.lib.KerberosTime
	 * @see krb5.lib.TicketFlags
	 * @see krb5.lib.Realm
	 * @see krb5.lib.PrincipalName
	 * @see krb5.lib.HostAddresses
	 */
	public EncTGSRepPart(
		EncryptionKey new_key,
		LastReq new_lastReq,
		int new_nonce,
		KerberosTime new_keyExpiration,
		TicketFlags new_flags,
		KerberosTime new_authtime,
		KerberosTime new_starttime,
		KerberosTime new_endtime,
		KerberosTime new_renewTill,
		Realm new_srealm,
		PrincipalName new_sname,
		HostAddresses new_caddr
	) {
		super(
			new_key,
			new_lastReq,
			new_nonce,
			new_keyExpiration,
			new_flags,
			new_authtime,
			new_starttime,
			new_endtime,
			new_renewTill,
			new_srealm,
			new_sname,
			new_caddr,
			Krb5.KRB_ENC_TGS_REP_PART
		);
	}

	/**
	 * Class constructor
	 *
	 * @param data is of type byte[]
	 * @exception Asn1Exception an exception
	 * @exception BitStringException an exception
	 * @exception RealmException an exception
	 * @exception KrbApErrException an exception
	 * @see krb5.lib.Asn1Exception
	 * @see krb5.lib.BitStringException
	 * @see krb5.lib.RealmException
	 * @see krb5.lib.KrbApErrException
	 */
	public EncTGSRepPart(byte[] data) throws Asn1Exception,
		BitStringException, RealmException, KrbApErrException {
		this(new EncodeRef(data));
	}

	/**
	 * Class constructor
	 *
	 * @param ref is of type EncodeRef
	 * @exception Asn1Exception an exception
	 * @exception BitStringException an exception
	 * @exception RealmException an exception
	 * @exception KrbApErrException an exception
	 * @see krb5.lib.asn1.EncodeRef
	 * @see krb5.lib.Asn1Exception
	 * @see krb5.lib.BitStringException
	 * @see krb5.lib.RealmException
	 * @see krb5.lib.KrbApErrException
	 */
	public EncTGSRepPart(EncodeRef ref) throws Asn1Exception,
		BitStringException, RealmException, KrbApErrException {
		super(ref, Krb5.KRB_ENC_TGS_REP_PART);
	}

	/**
	 * Encodes the object in asn1
	 *
	 * @return byte[] is a result
	 * @exception Asn1Exception an exception
	 * @exception BitStringException an exception
	 * @see krb5.lib.Asn1Exception
	 * @see krb5.lib.BitStringException
	 */
	public byte[] asn1Encode() throws Asn1Exception,
		BitStringException {
		return asn1Encode(Krb5.KRB_ENC_TGS_REP_PART);
	}

}