Fixed CertificateChain issues

This commit is contained in:
givememystuffplease 2010-07-06 21:14:51 +00:00
parent 084cd878e2
commit 3a4a00838e
2 changed files with 28 additions and 2 deletions

View File

@ -121,6 +121,18 @@ namespace libWiiSharp
return FromTikTmd(File.ReadAllBytes(pathToTik), File.ReadAllBytes(pathToTmd));
}
/// <summary>
/// Grabs certificates from Ticket and Tmd.
/// Ticket and Tmd must contain certs! (They do when they're downloaded from NUS!)
/// </summary>
/// <param name="pathToTik"></param>
/// <param name="pathToTmd"></param>
/// <returns></returns>
public static CertificateChain FromTikTmd(string pathToTik, byte[] tmdFile)
{
return FromTikTmd(File.ReadAllBytes(pathToTik), tmdFile);
}
/// <summary>
/// Grabs certificates from Ticket and Tmd.
/// Ticket and Tmd must contain certs! (They do when they're downloaded from NUS!)
@ -209,6 +221,18 @@ namespace libWiiSharp
LoadFromTikTmd(File.ReadAllBytes(pathToTik), File.ReadAllBytes(pathToTmd));
}
/// <summary>
/// Grabs certificates from Ticket and Tmd.
/// Ticket and Tmd must contain certs! (They do when they're downloaded from NUS!)
/// </summary>
/// <param name="pathToTik"></param>
/// <param name="tmdFile"></param>
/// <returns></returns>
public void LoadFromTikTmd(string pathToTik, byte[] tmdFile)
{
LoadFromTikTmd(File.ReadAllBytes(pathToTik), tmdFile);
}
/// <summary>
/// Grabs certificates from Ticket and Tmd.
/// Ticket and Tmd must contain certs! (They do when they're downloaded from NUS!)

View File

@ -307,9 +307,11 @@ namespace libWiiSharp
//Download TMD
fireDebug(" Downloading TMD...");
TMD tmd;
byte[] tmdFileWithCerts;
try
{
tmd = TMD.Load(wcNus.DownloadData(titleUrl + tmdFile));
tmdFileWithCerts = wcNus.DownloadData(titleUrl + tmdFile);
tmd = TMD.Load(tmdFileWithCerts);
}
catch (Exception ex) { fireDebug(" Downloading TMD Failed..."); throw new Exception("Downloading TMD Failed:\n" + ex.Message); }
@ -402,7 +404,7 @@ namespace libWiiSharp
if (storeWad)
{
fireDebug(" Building Certificate Chain...");
CertificateChain cert = CertificateChain.FromTikTmd(Path.Combine(outputDir, "cetk"), Path.Combine(outputDir, tmdFile));
CertificateChain cert = CertificateChain.FromTikTmd(Path.Combine(outputDir, "cetk"), tmdFileWithCerts);
byte[][] contents = new byte[tmd.NumOfContents][];