public static int GetSectionCount(ValueStorage storage) { var magic = (string)storage.Get("magic"); var version = (int)storage.Get("version"); switch (magic) { case "TEX0": switch (version) { case 2: return(2); default: return(1); } case "PLT0": return(1); default: return(0); } }
public static int GetPublicKeyPadding(ValueStorage storage) { var keyType = (int)storage.Get(nameof(CiaCertificate.keyType)); switch (keyType) { case 0: return(0x34); case 1: return(0x34); case 2: return(0x3C); default: throw new InvalidOperationException($"Unsupported key type {keyType}."); } }
public static int GetSignaturePadding(ValueStorage storage) { var sigType = (int)storage.Get("sigType"); switch (sigType) { case 0x010003: return(0x3C); case 0x010004: return(0x3C); case 0x010005: return(0x40); default: throw new InvalidOperationException($"Unsupported signature type {sigType:X8}."); } }