public static byte[] EncodeInitialNegToken(byte[] token,
                                                   KerberosConstValue.OidPkt oidPkt)
        {
            int[] oidInt;
            if (oidPkt == KerberosConstValue.OidPkt.KerberosToken)
            {
                oidInt = KerberosConstValue.GetKerberosOidInt();
            }
            else if (oidPkt == KerberosConstValue.OidPkt.MSKerberosToken)
            {
                oidInt = KerberosConstValue.GetMsKerberosOidInt();
            }
            else
            {
                throw new NotSupportedException("oid not support");
            }

            MechTypeList mechTypeList = new MechTypeList(
                new MechType[]
            {
                new MechType(oidInt)
            }
                );

            Asn1OctetString octetString = new Asn1OctetString(token);
            NegTokenInit    init        = new NegTokenInit(mechTypeList, null, new Asn1OctetString(octetString.ByteArrayValue), new Asn1OctetString((byte[])null));

            NegotiationToken negToken = new NegotiationToken(NegotiationToken.negTokenInit, init);

            MechType        spnegoMech = new MechType(KerberosConstValue.GetSpngOidInt());
            InitialNegToken initToken  = new InitialNegToken(spnegoMech, negToken);

            Asn1BerEncodingBuffer buffer = new Asn1BerEncodingBuffer();

            initToken.BerEncode(buffer);

            return(buffer.Data);
        }
 /// <summary>
 /// Constructor
 /// Generally used when encoding
 /// </summary>
 /// <param name="token">The Asn.1 formatted token contains in the class</param>
 public SpngInitialNegToken(InitialNegToken token)
     : base(token)
 {
 }