Ejemplo n.º 1
0
 /// <summary>
 /// Decrypts and unpacks DS2's regulation BND4 from the specified path.
 /// </summary>
 public static BND4 DecryptDS2Regulation(string path)
 {
     byte[] bytes = File.ReadAllBytes(path);
     byte[] iv    = new byte[16];
     iv[0] = 0x80;
     Array.Copy(bytes, 0, iv, 1, 11);
     iv[15] = 1;
     byte[] input = new byte[bytes.Length - 32];
     Array.Copy(bytes, 32, input, 0, bytes.Length - 32);
     using (var ms = new MemoryStream(input))
     {
         byte[] decrypted = CryptographyUtility.DecryptAesCtr(ms, ds2RegulationKey, iv);
         return(BND4.Read(decrypted));
     }
 }
Ejemplo n.º 2
0
 /// <summary>
 /// Decrypts and unpacks DS3's regulation BND4 from the specified path.
 /// </summary>
 public static BND4 DecryptDS3Regulation(string path)
 {
     byte[] bytes = File.ReadAllBytes(path);
     bytes = DecryptByteArray(ds3RegulationKey, bytes);
     return(BND4.Read(bytes));
 }