mirror of
https://github.com/Thealexbarney/LibHac.git
synced 2024-11-14 10:49:41 +01:00
KeySet.DeriveKeys now derives both sets automatically
This commit is contained in:
parent
c99f04970f
commit
9f81b933e8
3 changed files with 14 additions and 18 deletions
|
@ -91,7 +91,7 @@ namespace LibHacBuild.CodeGen.Stage2
|
||||||
var keySet = new KeySet();
|
var keySet = new KeySet();
|
||||||
|
|
||||||
// Populate the key set with all the keys in IncludedKeys.txt
|
// Populate the key set with all the keys in IncludedKeys.txt
|
||||||
using (Stream keyFile = Common.GetResource(InputMainKeyFileName))
|
using (Stream keyFile = GetResource(InputMainKeyFileName))
|
||||||
{
|
{
|
||||||
List<KeyInfo> list = KeySet.CreateKeyInfoList();
|
List<KeyInfo> list = KeySet.CreateKeyInfoList();
|
||||||
ExternalKeyReader.ReadMainKeys(keySet, keyFile, list);
|
ExternalKeyReader.ReadMainKeys(keySet, keyFile, list);
|
||||||
|
|
|
@ -67,14 +67,6 @@ namespace LibHac.Common.Keys
|
||||||
}
|
}
|
||||||
|
|
||||||
keySet.DeriveKeys(logger);
|
keySet.DeriveKeys(logger);
|
||||||
|
|
||||||
// Dev keys can be read from prod key files, so derive any missing keys if necessary.
|
|
||||||
if (keySet.CurrentMode == KeySet.Mode.Prod)
|
|
||||||
{
|
|
||||||
keySet.SetMode(KeySet.Mode.Dev);
|
|
||||||
keySet.DeriveKeys(logger);
|
|
||||||
keySet.SetMode(KeySet.Mode.Prod);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
@ -122,14 +114,6 @@ namespace LibHac.Common.Keys
|
||||||
}
|
}
|
||||||
|
|
||||||
keySet.DeriveKeys(logger);
|
keySet.DeriveKeys(logger);
|
||||||
|
|
||||||
// Dev keys can read from prod key files, so derive any missing keys if necessary.
|
|
||||||
if (keySet.CurrentMode == KeySet.Mode.Prod)
|
|
||||||
{
|
|
||||||
keySet.SetMode(KeySet.Mode.Dev);
|
|
||||||
keySet.DeriveKeys(logger);
|
|
||||||
keySet.SetMode(KeySet.Mode.Prod);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
|
|
@ -207,7 +207,19 @@ namespace LibHac.Common.Keys
|
||||||
return DefaultKeySet.CreateKeyList();
|
return DefaultKeySet.CreateKeyList();
|
||||||
}
|
}
|
||||||
|
|
||||||
public void DeriveKeys(IProgressReport logger = null) => KeyDerivation.DeriveAllKeys(this, logger);
|
public void DeriveKeys(IProgressReport logger = null)
|
||||||
|
{
|
||||||
|
Mode originalMode = CurrentMode;
|
||||||
|
|
||||||
|
SetMode(Mode.Prod);
|
||||||
|
KeyDerivation.DeriveAllKeys(this, logger);
|
||||||
|
|
||||||
|
SetMode(Mode.Dev);
|
||||||
|
KeyDerivation.DeriveAllKeys(this, logger);
|
||||||
|
|
||||||
|
SetMode(originalMode);
|
||||||
|
}
|
||||||
|
|
||||||
public void DeriveSdCardKeys() => KeyDerivation.DeriveSdCardKeys(this);
|
public void DeriveSdCardKeys() => KeyDerivation.DeriveSdCardKeys(this);
|
||||||
|
|
||||||
private static RSAParameters CreateRsaParameters(in RsaKey key)
|
private static RSAParameters CreateRsaParameters(in RsaKey key)
|
||||||
|
|
Loading…
Reference in a new issue