Пример #1
0
        // Class(60) {
        //   OID(spnego),
        //   Class(A0) {
        //     Class(30) {
        //       Class(A0) {
        //         Class(30) { OID,OID,OID} },
        //       Class(A2) { OctetStream } } } }
        public byte [] ProcessSpnegoInitialContextTokenRequest()
        {
            Type1Message type1 = new Type1Message(NtlmVersion.Version3);

            type1.Flags  = unchecked ((NtlmFlags)0xE21882B7);
            type1.Domain = "WORKGROUP"; // FIXME: remove it

            ASN1 asn     = new ASN1(0x60);
            ASN1 asn2    = new ASN1(0xA0);
            ASN1 asn21   = new ASN1(0x30);
            ASN1 asn211  = new ASN1(0xA0);
            ASN1 asn2111 = new ASN1(0x30);

            asn211.Add(asn2111);
            asn2111.Add(ASN1Convert.FromOid(Constants.OidNtlmSsp));
            asn2111.Add(ASN1Convert.FromOid(Constants.OidKerberos5));
            asn2111.Add(ASN1Convert.FromOid(Constants.OidMIT));
            ASN1 asn212  = new ASN1(0xA2);
            ASN1 asn2121 = new ASN1(0x4);

            asn2121.Value = type1.GetBytes();
            asn212.Add(asn2121);
            asn21.Add(asn211);
            asn21.Add(asn212);
            asn2.Add(asn21);
            asn.Add(ASN1Convert.FromOid(Constants.OidSpnego));
            asn.Add(asn2);
            return(asn.GetBytes());
        }
Пример #2
0
        public byte [] ProcessMessageType1()
        {
            Type1Message type1 = new Type1Message(NtlmVersion.Version3);

            type1.Flags = unchecked ((NtlmFlags)0xE21882B7);
            return(type1.GetBytes());
        }
Пример #3
0
        // Example from http://www.innovation.ch/java/ntlm.html
        public void Encode1()
        {
            Type1Message msg = new Type1Message();

            AssertEquals("Type", 1, msg.Type);
            msg.Domain = "Ursa-Minor";
            msg.Host   = "LightCity";
            AssertEquals("GetBytes", "4E-54-4C-4D-53-53-50-00-01-00-00-00-03-B2-00-00-0A-00-0A-00-29-00-00-00-09-00-09-00-20-00-00-00-4C-49-47-48-54-43-49-54-59-55-52-53-41-2D-4D-49-4E-4F-52", BitConverter.ToString(msg.GetBytes()));
        }