Line 139:
Line 139:
public static byte[] EncryptMyTitleKey(byte[] commonKey, byte[] titleKey, ulong titleId)
public static byte[] EncryptMyTitleKey(byte[] commonKey, byte[] titleKey, ulong titleId)
{
{
+
// Make encryption IV
byte[] titleidasbytes = new byte[0x10];
byte[] titleidasbytes = new byte[0x10];
for (int i = 0; i < 0x10; i++)
for (int i = 0; i < 0x10; i++)
Line 150:
Line 151:
}
}
bitBytes.CopyTo(titleidasbytes, 0);
bitBytes.CopyTo(titleidasbytes, 0);
+
// Encrypt
ICryptoTransform transform = new AesManaged { Key = commonKey, IV = titleidasbytes, Mode = CipherMode.CBC }.CreateEncryptor(commonKey, titleidasbytes);
ICryptoTransform transform = new AesManaged { Key = commonKey, IV = titleidasbytes, Mode = CipherMode.CBC }.CreateEncryptor(commonKey, titleidasbytes);
MemoryStream memstream = new MemoryStream();
MemoryStream memstream = new MemoryStream();