Example #1
0
        private static byte[] calculateDecryptedKey(byte[] encryptedKey, byte[] IV)
        {
            AESDecryption decryption = new AESDecryption(Settings.commonKey, IV)
            {
            };

            return(decryption.decrypt(encryptedKey));
        }
Example #2
0
        public NUSTitle loadNusTitle(NUSTitleConfig config)
        {
            NUSTitle result = new NUSTitle();

            NUSDataProvider dataProvider = getDataProvider(result, config);

            result.dataProvider = (dataProvider);

            TMD tmd = TMD.parseTMD(dataProvider.getRawTMD());

            result.TMD = (tmd);

            if (tmd == null)
            {
                //MessageBox.Show("TMD not found.");
                throw new Exception();
            }

            Ticket ticket = config.ticket;

            if (ticket == null)
            {
                ticket = Ticket.parseTicket(dataProvider.getRawTicket());
            }
            result.ticket = ticket;
            // System.out.println(ticket);

            Content fstContent = tmd.getContentByIndex(0);

            MemoryStream fstContentEncryptedStream = dataProvider.getInputStreamFromContent(fstContent, 0);

            if (fstContentEncryptedStream == null)
            {
                return(null);
            }

            byte[] fstBytes = fstContentEncryptedStream.ToArray();// StreamUtils.getBytesFromStream(fstContentEncryptedStream, (int)fstContent.getEncryptedFileSize());

            if (fstContent.isEncrypted())
            {
                AESDecryption aesDecryption = new AESDecryption(ticket.decryptedKey, new byte[0x10]);
                fstBytes = aesDecryption.decrypt(fstBytes);
            }

            Dictionary <int, Content> contents = tmd.getAllContents();

            FST fst = FST.parseFST(fstBytes, contents);

            result.FST = (fst);

            return(result);
        }
Example #3
0
        public byte[] readDecryptedChunk(long readOffset, byte[] key, byte[] IV)
        {
            int chunkSize = 0x8000;

            byte[] encryptedChunk = readEncryptedToByteArray(readOffset, 0, chunkSize);
            byte[] decryptedChunk = new byte[chunkSize];

            AESDecryption aesDecryption = new AESDecryption(key, IV);

            decryptedChunk = aesDecryption.decrypt(encryptedChunk);

            return(decryptedChunk);
        }