示例#1
0
        public byte[] request_controlword(byte[] cardstring)
        {
            byte[] key1 = new byte[8];
            byte[] key2 = new byte[8];
            byte[] cw   = new byte[16];

            Form1 cardcomm = new Form1();

            CardSimples cardcrypt = new CardSimples();
            //Form1 cardcomm = new Form1();

            cardcomm.com.Output = cardstring;
            System.Threading.Thread.Sleep(150);

            availableBytes = cardcomm.com.InBufferCount;
            indata = (byte[]) cardcomm.com.Input;

            if((indata[2]==0x9D) && (indata[3]==0x00))
            {
                Array.Copy(indata,14,key1,0,8);
                Array.Copy(indata,22,key2,0,8);

                cardcrypt.ReverseSessionKeyCrypt(cardcomm.CamKey,key1);
                cardcrypt.ReverseSessionKeyCrypt(cardcomm.CamKey,key2);

                Array.Copy(key1,0,cw,0,8);
                Array.Copy(key2,0,cw,8,8);

            }

            return cw;
        }
示例#2
0
        public byte[] generate_cardrequest(byte[] message)
        {
            /* |  |  |     |           |     |     |           |     |     |
             *  00 54 C4 2C 0F F1 BA 6F 00 14 17 22 00 00 00 00 F0 14 DD 40
             * first byte is mode: 00=> ECM, 02=>EMM
             * second byte is lengh of data (ECM,EMM)
             * third and fourth byte are fillers
             * next 4 bytes are crc-checksum of data (ECM,EMM)
             * next 2 bytes is Channel-ID (important for later "Abos")
             * then comes Provider-ID (Cable or Sattelite)
             * some 4 Byte crap (always zero) ...
             */

            int ChID = 0x0000;
            byte[] PID = new byte[2];
            byte[] ECM = new byte[85];
            byte[] modECM = { 0x01,0x05,0x00,0x00,0x02,0x4E };

            ChID = (message[8]<<8) + message[9];
            Array.Copy(message,10,PID,0,2);
            Array.Copy(message,20,ECM,0,84);
            Array.Copy(modECM,0,ECM,0,6);

            CardSimples xorbyte = new CardSimples();

            ECM[84] = xorbyte.XorSum(ECM,84);
            return ECM;
        }