Exemplo n.º 1
0
 public void Receive(TLSRecord record)
 {
     lock (_lock)
     {
         var response = this.TLSContext.Process_Record(record);
         this.Send(response);
     }
 }
Exemplo n.º 2
0
        public void SendChangeCipherSpec()
        {
            this.css_hs    = new byte[1];
            this.css_hs[0] = 0x1;

            TLSRecord   css    = new TLSRecord(0x14, (short)0x303, 1, this.css_hs);
            List <byte> cssBuf = css.GetBytes();

            this.ns.Write(cssBuf.ToArray(), 0, cssBuf.Count);
        }
Exemplo n.º 3
0
        public int SendHS(byte type)
        {
            try
            {
                this.hs    = new TLSHandshake((byte)type, (UInt32)this.pktBuf.Count, this.pktBuf.ToArray());
                this.hsBuf = this.hs.CreateHS();

                int hsType = this.common.ReadAtLoc(this.hsBuf.ToArray(), 0, 1);
                this.hsLen = (short)this.hsBuf.Count;

                if (hsType == 1)
                {
                    this.cHello_hs = new byte[this.hsLen];
                    Array.Copy(this.hsBuf.ToArray(), 0, this.cHello_hs, 0, this.hsLen);
                }

                if (hsType == 16)
                {
                    this.cke_hs = new byte[this.hsLen];
                    Array.Copy(this.hsBuf.ToArray(), 0, this.cke_hs, 0, this.hsLen);
                }

                this.rec = new TLSRecord(0x16, (short)0x303, this.hsLen, this.hsBuf.ToArray());

                this.recBuf = this.rec.GetBytes();
                this.recLen = (short)this.recBuf.Count;

                this.ns.Write(this.recBuf.ToArray(), 0, this.recLen);

                this.ReallocBufs();
            }
            catch (Exception e)
            {
                this.sendExcp = e;
                return(-1);
            }
            return(0);
        }