Beispiel #1
0
        public static AACSMediaKeyBlock? DecodeAACSMediaKeyBlock(byte[] AACSMKBResponse)
        {
            if(AACSMKBResponse == null)
                return null;

            var decoded = new AACSMediaKeyBlock();

            decoded.MediaKeyBlockPacks = new byte[AACSMKBResponse.Length - 4];

            decoded.DataLength = BigEndianBitConverter.ToUInt16(AACSMKBResponse, 0);
            decoded.Reserved   = AACSMKBResponse[2];
            decoded.TotalPacks = AACSMKBResponse[3];
            Array.Copy(AACSMKBResponse, 4, decoded.MediaKeyBlockPacks, 0, AACSMKBResponse.Length - 4);

            return decoded;
        }
Beispiel #2
0
        public static string PrettifyAACSMediaKeyBlock(AACSMediaKeyBlock? AACSMKBResponse)
        {
            if(AACSMKBResponse == null)
                return null;

            AACSMediaKeyBlock response = AACSMKBResponse.Value;

            var sb = new StringBuilder();

        #if DEBUG
            if(response.Reserved != 0)
                sb.AppendFormat("Reserved = 0x{0:X2}", response.Reserved).AppendLine();
        #endif
            sb.AppendFormat("Total number of media key blocks available to transfer {0}", response.TotalPacks).
               AppendLine();

            sb.AppendFormat("AACS Media Key Blocks in hex follows:");
            sb.AppendLine(PrintHex.ByteArrayToHexArrayString(response.MediaKeyBlockPacks, 80));

            return sb.ToString();
        }