mirror of
https://github.com/Thealexbarney/LibHac.git
synced 2024-11-14 10:49:41 +01:00
Add SetSize to AesXtsFileHeader
This commit is contained in:
parent
b1fd90dc4d
commit
0b79dfe93a
5 changed files with 22 additions and 4 deletions
|
@ -72,6 +72,8 @@ namespace LibHac.IO
|
||||||
|
|
||||||
public override void SetSize(long size)
|
public override void SetSize(long size)
|
||||||
{
|
{
|
||||||
|
Header.SetSize(size, VerificationKey);
|
||||||
|
|
||||||
throw new NotImplementedException();
|
throw new NotImplementedException();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -13,7 +13,7 @@ namespace LibHac.IO
|
||||||
public uint Magic { get; }
|
public uint Magic { get; }
|
||||||
public byte[] EncryptedKey1 { get; } = new byte[0x10];
|
public byte[] EncryptedKey1 { get; } = new byte[0x10];
|
||||||
public byte[] EncryptedKey2 { get; } = new byte[0x10];
|
public byte[] EncryptedKey2 { get; } = new byte[0x10];
|
||||||
public long Size { get; }
|
public long Size { get; private set; }
|
||||||
|
|
||||||
public byte[] DecryptedKey1 { get; } = new byte[0x10];
|
public byte[] DecryptedKey1 { get; } = new byte[0x10];
|
||||||
public byte[] DecryptedKey2 { get; } = new byte[0x10];
|
public byte[] DecryptedKey2 { get; } = new byte[0x10];
|
||||||
|
@ -63,6 +63,12 @@ namespace LibHac.IO
|
||||||
return Util.ArraysEqual(hmac, Signature);
|
return Util.ArraysEqual(hmac, Signature);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void SetSize(long size, byte[] verificationKey)
|
||||||
|
{
|
||||||
|
Size = size;
|
||||||
|
Signature = CalculateHmac(verificationKey);
|
||||||
|
}
|
||||||
|
|
||||||
private void DecryptKeys()
|
private void DecryptKeys()
|
||||||
{
|
{
|
||||||
Crypto.DecryptEcb(Kek1, EncryptedKey1, DecryptedKey1, 0x10);
|
Crypto.DecryptEcb(Kek1, EncryptedKey1, DecryptedKey1, 0x10);
|
||||||
|
|
|
@ -35,7 +35,7 @@ namespace LibHac.IO
|
||||||
destFs.CreateFile(subDstPath, entry.Size, options);
|
destFs.CreateFile(subDstPath, entry.Size, options);
|
||||||
|
|
||||||
using (IFile srcFile = sourceFs.OpenFile(subSrcPath, OpenMode.Read))
|
using (IFile srcFile = sourceFs.OpenFile(subSrcPath, OpenMode.Read))
|
||||||
using (IFile dstFile = destFs.OpenFile(subDstPath, OpenMode.Write))
|
using (IFile dstFile = destFs.OpenFile(subDstPath, OpenMode.Write | OpenMode.Append))
|
||||||
{
|
{
|
||||||
logger?.LogMessage(subSrcPath);
|
logger?.LogMessage(subSrcPath);
|
||||||
srcFile.CopyTo(dstFile, logger);
|
srcFile.CopyTo(dstFile, logger);
|
||||||
|
|
|
@ -6,9 +6,19 @@ namespace LibHac.IO
|
||||||
{
|
{
|
||||||
private string BasePath { get; }
|
private string BasePath { get; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Opens a directory on local storage as an <see cref="IFileSystem"/>.
|
||||||
|
/// The directory will be created if it does not exist.
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="basePath">The path that will be the root of the <see cref="LocalFileSystem"/>.</param>
|
||||||
public LocalFileSystem(string basePath)
|
public LocalFileSystem(string basePath)
|
||||||
{
|
{
|
||||||
BasePath = Path.GetFullPath(basePath);
|
BasePath = Path.GetFullPath(basePath);
|
||||||
|
|
||||||
|
if (!Directory.Exists(BasePath))
|
||||||
|
{
|
||||||
|
Directory.CreateDirectory(BasePath);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
internal string ResolveLocalPath(string path)
|
internal string ResolveLocalPath(string path)
|
||||||
|
|
|
@ -268,13 +268,13 @@ namespace LibHac
|
||||||
Control,
|
Control,
|
||||||
Manual,
|
Manual,
|
||||||
Data,
|
Data,
|
||||||
AocData
|
PublicData
|
||||||
}
|
}
|
||||||
|
|
||||||
public enum DistributionType
|
public enum DistributionType
|
||||||
{
|
{
|
||||||
Download,
|
Download,
|
||||||
Gamecard
|
GameCard
|
||||||
}
|
}
|
||||||
|
|
||||||
public enum NcaEncryptionType
|
public enum NcaEncryptionType
|
||||||
|
|
Loading…
Reference in a new issue