Example #1
0
        /// <summary>
        /// Aktiviert die Entschlüsselung eines Senders.
        /// </summary>
        /// <param name="pmt">Daten zum Sender.</param>
        /// <returns>Die neue Befehlssequenz.</returns>
        public static CACommand CreateDecrypt(PMT pmt)
        {
            // Create helper
            byte[] table = pmt.Section.CreateSITable();

            // Create
            CACommand command = new CACommand();

            // Fill command
            command.Tag         = (byte)CACommandTags.Decrypt;
            command.CommandData = new byte[MaxDataLength];

            // Fill data
            command.CommandData[0] = (byte)CAListTypes.One;
            command.CommandData[1] = (byte)PMTCommands.Descramble;

            // Calculate the length - we are in trouble if PMT is too long!
            command.Length = (ushort)(2 + Math.Min(command.CommandData.Length - 2, table.Length - 1));

            // Copy over and get rid of the offset byte
            Array.Copy(table, 1, command.CommandData, 2, command.Length - 2);

            // Report
            return(command);
        }
Example #2
0
        /// <summary>
        /// Setzt einen Parameter.
        /// </summary>
        /// <param name="propertySetId">Die eindeutige Kennung der Parametergruppe.</param>
        /// <param name="propertyId">Die laufende Nummer des Parameters.</param>
        /// <param name="instanceData">Die Daten der Instanz.</param>
        /// <param name="instanceDataLength">Die Größe der Daten der Instanz.</param>
        /// <param name="value">Der neue Wert.</param>
        /// <param name="valueLength">Die Größe des neuen Wertes.</param>
        public void Set(ref Guid propertySetId, BDAProperties propertyId, ref CACommand instanceData, Int32 instanceDataLength, ref CACommand value, Int32 valueLength)
        {
            // Process
            Int32 hResult = m_Set(ComInterface, ref propertySetId, propertyId, ref instanceData, instanceDataLength, ref value, valueLength);

            if (hResult < 0)
            {
                throw new COMException("KsPropertySet.Set", hResult);
            }
        }
Example #3
0
        /// <summary>
        /// Führt einen CI Befehl aus.
        /// </summary>
        /// <param name="command">Der gewünschte Befehl.</param>
        public void Send(CACommand command)
        {
            // Load property set identifier
            var propSetId = CIControl.PropertySetId;

            // Create a clone
            var clone = command.Clone();

            // Get the raw size
            int commandSize = Marshal.SizeOf(command), cloneSize = Marshal.SizeOf(clone);

            // Send the command
            Set(ref propSetId, BDAProperties.SendCA, ref command, commandSize, ref clone, cloneSize);
        }
Example #4
0
        /// <summary>
        /// Erzeugt einen Befehlssequenz zur Deaktivierung des CI.
        /// </summary>
        /// <returns>Eine neue Befehlssequenz.</returns>
        public static CACommand CreateReset()
        {
            // Create
            CACommand command = new CACommand();

            // Fill command
            command.Tag = (byte) CACommandTags.Reset;
            command.CommandData = new byte[MaxDataLength];

            // Fill data
            command.CommandData[0] = (byte) CACommandTags.Reset;
            command.Length = 1;

            // Report
            return command;
        }
Example #5
0
        /// <summary>
        /// Erzeugt eine Kopie.
        /// </summary>
        /// <returns>Eine exakte Kopie.</returns>
        public CACommand Clone()
        {
            // Create clone
            CACommand clone = new CACommand();

            // Fill
            clone.CommandData = (null == CommandData) ? null : (byte[]) CommandData.Clone();
            clone._Padding = _Padding;
            clone.Length = Length;
            clone.More = More;
            clone.Slot = Slot;
            clone.Tag = Tag;

            // Report
            return clone;
        }
Example #6
0
        /// <summary>
        /// Erzeugt einen Befehlssequenz zur Deaktivierung des CI.
        /// </summary>
        /// <returns>Eine neue Befehlssequenz.</returns>
        public static CACommand CreateReset()
        {
            // Create
            CACommand command = new CACommand();

            // Fill command
            command.Tag         = (byte)CACommandTags.Reset;
            command.CommandData = new byte[MaxDataLength];

            // Fill data
            command.CommandData[0] = (byte)CACommandTags.Reset;
            command.Length         = 1;

            // Report
            return(command);
        }
Example #7
0
        /// <summary>
        /// Erzeugt eine Kopie.
        /// </summary>
        /// <returns>Eine exakte Kopie.</returns>
        public CACommand Clone()
        {
            // Create clone
            CACommand clone = new CACommand();

            // Fill
            clone.CommandData = (null == CommandData) ? null : (byte[])CommandData.Clone();
            clone._Padding    = _Padding;
            clone.Length      = Length;
            clone.More        = More;
            clone.Slot        = Slot;
            clone.Tag         = Tag;

            // Report
            return(clone);
        }
Example #8
0
        /// <summary>
        /// Deaktiviert die Entschlüsselung.
        /// </summary>
        /// <returns>Die neue Befehlssequenz.</returns>
        public static CACommand StopDecryption()
        {
            // Create
            CACommand command = new CACommand();

            // Fill command
            command.Tag         = (byte)CACommandTags.Decrypt;
            command.CommandData = new byte[MaxDataLength];

            // Fill data
            command.Length         = 2;
            command.CommandData[0] = (byte)CAListTypes.One;
            command.CommandData[1] = (byte)PMTCommands.NotSelected;

            // Report
            return(command);
        }
Example #9
0
        /// <summary>
        /// Wird zur eigentlichen Steuerung der Entschlüsselung aufgerufen.
        /// </summary>
        /// <param name="pmt">Die Informationen zur Quelle.</param>
        /// <param name="reset">Gesetzt, um einen Neustart der Entschlüsselung zu erzwingen.</param>
        private void Decrypt(EPG.Tables.PMT pmt, bool reset)
        {
            // Check the interface
            var setPtr = ComIdentity.QueryInterface(m_DataGraph.TunerFilter.Interface, typeof(KsPropertySetFireDTV.Interface));

            if (setPtr == IntPtr.Zero)
            {
                return;
            }

            // Process
            using (var propertySet = new KsPropertySetFireDTV(setPtr))
                try
                {
                    // Load property identifier
                    var propSetId = PropertySetId;
                    var supported = propertySet.QuerySupported(ref propSetId, BDAProperties.SendCA);
                    if ((PropertySetSupportedTypes.Set & supported) != PropertySetSupportedTypes.Set)
                    {
                        return;
                    }

                    // Process reset
                    if (reset)
                    {
                        propertySet.Send(CACommand.CreateReset());
                    }
                    else if (pmt == null)
                    {
                        propertySet.Send(CACommand.StopDecryption());
                    }
                    else
                    {
                        propertySet.Send(CACommand.CreateDecrypt(pmt));
                    }
                }
                catch
                {
                    // Forward if not resetting
                    if (pmt != null)
                    {
                        throw;
                    }
                }
        }
Example #10
0
        /// <summary>
        /// Aktiviert die Entschlüsselung eines Senders.
        /// </summary>
        /// <param name="pmt">Daten zum Sender.</param>
        /// <returns>Die neue Befehlssequenz.</returns>
        public static CACommand CreateDecrypt( PMT pmt )
        {
            // Create helper
            byte[] table = pmt.Section.CreateSITable();

            // Create
            CACommand command = new CACommand();

            // Fill command
            command.Tag = (byte) CACommandTags.Decrypt;
            command.CommandData = new byte[MaxDataLength];

            // Fill data
            command.CommandData[0] = (byte) CAListTypes.One;
            command.CommandData[1] = (byte) PMTCommands.Descramble;

            // Calculate the length - we are in trouble if PMT is too long!
            command.Length = (ushort) (2 + Math.Min( command.CommandData.Length - 2, table.Length - 1 ));

            // Copy over and get rid of the offset byte
            Array.Copy( table, 1, command.CommandData, 2, command.Length - 2 );

            // Report
            return command;
        }
Example #11
0
        /// <summary>
        /// Deaktiviert die Entschlüsselung.
        /// </summary>
        /// <returns>Die neue Befehlssequenz.</returns>
        public static CACommand StopDecryption()
        {
            // Create
            CACommand command = new CACommand();

            // Fill command
            command.Tag = (byte) CACommandTags.Decrypt;
            command.CommandData = new byte[MaxDataLength];

            // Fill data
            command.Length = 2;
            command.CommandData[0] = (byte) CAListTypes.One;
            command.CommandData[1] = (byte) PMTCommands.NotSelected;

            // Report
            return command;
        }