/// <summary>
        /// Construct an kerbcred EncryptedData.
        /// </summary>
        /// <param name="key">The key to do encryption.</param>
        /// <returns>The EncKrbCredPart.</returns>
        private EncKrbCredPart ConstrutCredEncryptedData(EncryptionKey key)
        {
            EncKrbCredPart encKrbCred = new EncKrbCredPart();

            encKrbCred.nonce     = new KerbUInt32((uint)Math.Abs((int)DateTime.Now.Ticks));
            encKrbCred.timestamp = new KerberosTime(KileUtility.GetCurrentUTCTime());
            encKrbCred.usec      = new Microseconds(0);
            encKrbCred.s_address = new HostAddress(new KerbInt32((int)AddressType.NetBios),
                                                   new Asn1OctetString(Dns.GetHostName()));

            KrbCredInfo[] krbCredInfo = new KrbCredInfo[1];
            krbCredInfo[0]         = new KrbCredInfo();
            krbCredInfo[0].key     = key;
            encKrbCred.ticket_info = new Asn1SequenceOf <KrbCredInfo>(krbCredInfo);

            return(encKrbCred);
        }
        /// <summary>
        /// Construct EncKrbPrivPartof of KrbPrivRequest
        /// </summary>
        /// <param name="krbPrivRequest">to decide whether an seq_number in EncKrbPrivPart or not</param>
        /// <param name="userData">The user data want to send.</param>
        /// <returns>The EncKrbPrivPart.</returns>
        private EncKrbPrivPart ConstructEncKrbPrivPart(KRB_PRIV_REQUEST krbPrivRequest, byte[] userData)
        {
            EncKrbPrivPart encKrbPriv = new EncKrbPrivPart();

            encKrbPriv.s_address = new HostAddress(new KerbInt32((int)AddressType.NetBios),
                                                   new Asn1OctetString(Dns.GetHostName()));
            encKrbPriv.usec      = new Microseconds(0);
            encKrbPriv.user_data = new Asn1OctetString(userData);

            if (krbPrivRequest == KRB_PRIV_REQUEST.KrbPrivWithSequenceNumber)
            {
                encKrbPriv.seq_number = new KerbUInt32((long)context.CurrentLocalSequenceNumber);
                encKrbPriv.timestamp  = null;
            }
            else
            {
                encKrbPriv.seq_number = null;
                encKrbPriv.timestamp  = new KerberosTime(KileUtility.GetCurrentUTCTime());
            }

            return(encKrbPriv);
        }