Esempio n. 1
0
 private byte[] calculateBlockKey(int blk, NPD npd)
 {
     byte[] baseKey = (npd.getVersion() <= 1) ? (new byte[0x10]) : npd.getDevHash();
     byte[] result  = new byte[0x10];
     ConversionUtils.arraycopy(baseKey, 0, result, 0, 0xC);
     result[0xC] = (byte)(blk >> 24 & 0xFF);
     result[0xD] = (byte)(blk >> 16 & 0xFF);
     result[0xE] = (byte)(blk >> 8 & 0xFF);
     result[0xF] = (byte)(blk & 0xFF);
     return(result);
 }
Esempio n. 2
0
 private byte[] getKey(NPD npd, EDATData data, byte[] devKLic, byte[] keyFromRif)
 {
     byte[] result = null;
     if ((data.getFlags() & FLAG_SDAT) != 0)
     {
         //Case SDAT
         result = new byte[0x10];
         ToolsImpl.XOR(result, npd.getDevHash(), EDATKeys.SDATKEY);
     }
     else
     {
         //Case EDAT
         if (npd.getLicense() == 0x03)
         {
             result = devKLic;
         }
         else if (npd.getLicense() == 0x02)
         {
             result = keyFromRif;
         }
     }
     return(result);
 }