Beispiel #1
0
 private byte[] createNPDHash2(byte[] klicensee, byte[] npd)
 {
     byte[] output = new byte[0x10];
     ToolsImpl.XOR(output, klicensee, EDATKeys.npdrm_omac_key2);
     byte[] src = ToolsImpl.CMAC128(output, npd, 0, 0x60);
     ConversionUtils.arraycopy(src, 0, npd, 0x60L, 0x10);
     if (this.compareBytes(src, 0, npd, 0x60, 0x10))
     {
         return(src);
     }
     return(null);
 }
Beispiel #2
0
        private bool checkNPDHash2(byte[] klicensee, byte[] npd)
        {
            byte[] xoredKey = new byte[0x10];
            ToolsImpl.XOR(xoredKey, klicensee, EDATKeys.npdrm_omac_key2);
            byte[] calculated = ToolsImpl.CMAC128(xoredKey, npd, 0, 0x60);
            bool   result2    = compareBytes(calculated, 0, npd, 0x60, 0x10);

            if (result2)
            {
                Console.WriteLine("NPD hash 2 is valid (" + ConversionUtils.getHexString(calculated) + ")");
            }
            return(result2);
        }
Beispiel #3
0
        private bool checkNPDHash2(byte[] klicensee, byte[] npd)
        {
            byte[] output = new byte[0x10];
            ToolsImpl.XOR(output, klicensee, EDATKeys.npdrm_omac_key2);
            byte[] buffer2 = ToolsImpl.CMAC128(output, npd, 0, 0x60);
            bool   flag    = this.compareBytes(buffer2, 0, npd, 0x60, 0x10);

            if (flag)
            {
                Console.WriteLine("NPD hash 2 is valid (" + ConversionUtils.getHexString(buffer2) + ")");
            }
            return(flag);
        }
Beispiel #4
0
        private byte[] createNPDHash2(byte[] klicensee, byte[] npd)
        {
            byte[] xoredKey = new byte[0x10];
            ToolsImpl.XOR(xoredKey, klicensee, EDATKeys.npdrm_omac_key2);
            byte[] calculated = ToolsImpl.CMAC128(xoredKey, npd, 0, 0x60);
            ConversionUtils.arraycopy(calculated, 0, npd, 0x60, 0x10);
            bool result2 = compareBytes(calculated, 0, npd, 0x60, 0x10);

            if (result2)
            {
                return(calculated);
            }
            return(null);
        }
Beispiel #5
0
 private byte[] createNPDHash1(string filename, byte[] npd)
 {
     byte[] src  = ConversionUtils.charsToByte(filename.ToCharArray());
     byte[] dest = new byte[0x30 + src.Length];
     ConversionUtils.arraycopy(npd, 0x10, dest, 0L, 0x30);
     ConversionUtils.arraycopy(src, 0, dest, 0x30L, src.Length);
     byte[] buffer3 = ToolsImpl.CMAC128(EDATKeys.npdrm_omac_key3, dest, 0, dest.Length);
     ConversionUtils.arraycopy(buffer3, 0, npd, 80L, 0x10);
     if (this.compareBytes(buffer3, 0, npd, 80, 0x10))
     {
         return(buffer3);
     }
     return(null);
 }
Beispiel #6
0
        private bool checkNPDHash1(String filename, byte[] npd)
        {
            byte[] fileBytes = ConversionUtils.charsToByte(filename.ToCharArray());
            byte[] data1     = new byte[0x30 + fileBytes.Length];
            ConversionUtils.arraycopy(npd, 0x10, data1, 0, 0x30);
            ConversionUtils.arraycopy(fileBytes, 0x00, data1, 0x30, fileBytes.Length);
            byte[] hash1   = ToolsImpl.CMAC128(EDATKeys.npdrm_omac_key3, data1, 0, data1.Length);
            bool   result1 = compareBytes(hash1, 0, npd, 0x50, 0x10);

            if (result1)
            {
                Console.WriteLine("NPD hash 1 is valid (" + ConversionUtils.getHexString(hash1) + ")");
            }
            return(result1);
        }
Beispiel #7
0
        private bool checkNPDHash1(string filename, byte[] npd)
        {
            byte[] src  = ConversionUtils.charsToByte(filename.ToCharArray());
            byte[] dest = new byte[0x30 + src.Length];
            ConversionUtils.arraycopy(npd, 0x10, dest, 0L, 0x30);
            ConversionUtils.arraycopy(src, 0, dest, 0x30L, src.Length);
            byte[] buffer3 = ToolsImpl.CMAC128(EDATKeys.npdrm_omac_key3, dest, 0, dest.Length);
            bool   flag    = this.compareBytes(buffer3, 0, npd, 80, 0x10);

            if (flag)
            {
                Console.WriteLine("NPD hash 1 is valid (" + ConversionUtils.getHexString(buffer3) + ")");
            }
            return(flag);
        }
Beispiel #8
0
        private byte[] createNPDHash1(String filename, byte[] npd)
        {
            byte[] fileBytes = ConversionUtils.charsToByte(filename.ToCharArray());
            byte[] data1     = new byte[0x30 + fileBytes.Length];
            ConversionUtils.arraycopy(npd, 0x10, data1, 0, 0x30);
            ConversionUtils.arraycopy(fileBytes, 0x00, data1, 0x30, fileBytes.Length);
            byte[] hash1 = ToolsImpl.CMAC128(EDATKeys.npdrm_omac_key3, data1, 0, data1.Length);
            ConversionUtils.arraycopy(hash1, 0, npd, 0x50, 0x10);
            bool result1 = compareBytes(hash1, 0, npd, 0x50, 0x10);

            if (result1)
            {
                return(hash1);
            }
            return(null);
        }