예제 #1
0
        public void SetKey(string keyConfigFilePath)
        {
            XElement xml = XElement.Load(keyConfigFilePath);

            try
            {
                foreach (XElement element in xml.Elements((XName)"KeyAreaEncryptionKeys").Elements <XElement>((XName)"Key"))
                {
                    this.m_KeyAreaEncryptionKeyList.Add(Tuple.Create <int, AesKey>(Convert.ToInt32(element.Attribute((XName)"index").Value), new AesKey(Convert.FromBase64String(element.Value))));
                }
                this.m_ProdKeyAreaEncryptionKey   = KeyConfiguration.LoadAesKeyConfig(xml, "ProdKeyAreaEncryptionKey");
                this.m_ProdNcaHeaderEncryptionKek = KeyConfiguration.LoadAesKeyConfig(xml, "ProdNcaHeaderEncryptionKek");
                this.m_NcaHeader1SignKey          = KeyConfiguration.LoadRsaKeyConfig(xml, "NcaHeader1SignKey");
                this.m_AcidSignKey                     = KeyConfiguration.LoadRsaKeyConfig(xml, "NcaAcidSignKey");
                this.m_NrrCertificateSignKey           = KeyConfiguration.LoadRsaKeyConfig(xml, "NcaNrrCertificateSignKey");
                this.m_ProdXciHeaderSignKey            = KeyConfiguration.LoadRsaKeyConfig(xml, "ProdXciHeaderSignKey");
                this.m_ProdXciInitialDataEncryptionKey = KeyConfiguration.LoadAesKeyConfig(xml, "ProdXciInitialDataEncryptionKey");
                this.m_ProdTitleKeyGenarateKey         = KeyConfiguration.LoadAesKeyConfig(xml, "ProdTitleKeyGenarateKey");
                this.m_ProdETicketCommonKey            = KeyConfiguration.LoadAesKeyConfig(xml, "ProdETicketCommonKey");
                this.m_ProdETicketSignKey              = KeyConfiguration.LoadRsaKeyConfig(xml, "ProdETicketSignKey");
            }
            catch
            {
                throw new ArgumentException(string.Format("Failed to load key configuration from {0}.", (object)keyConfigFilePath));
            }
        }