예제 #1
0
        /// <summary>
        /// Grabs certificates from Ticket and Tmd.
        /// Ticket and Tmd must contain certs! (They do when they're downloaded from NUS!)
        /// </summary>
        /// <param name="tikFile"></param>
        /// <param name="tmdFile"></param>
        /// <returns></returns>
        public static CertificateChain FromTikTmd(byte[] tikFile, byte[] tmdFile)
        {
            CertificateChain certificateChain = new CertificateChain();
            MemoryStream     memoryStream1    = new MemoryStream(tikFile);

            try
            {
                certificateChain.GrabFromTik(memoryStream1);
            }
            catch
            {
                memoryStream1.Dispose();
                throw;
            }
            MemoryStream memoryStream2 = new MemoryStream(tmdFile);

            try
            {
                certificateChain.GrabFromTmd(memoryStream2);
            }
            catch
            {
                memoryStream2.Dispose();
                throw;
            }
            memoryStream2.Dispose();
            return(certificateChain.CertsComplete ? certificateChain : throw new Exception("Couldn't locate all certs!"));
        }
예제 #2
0
        /// <summary>
        /// Grabs certificates from Ticket and Tmd.
        /// Ticket and Tmd must contain certs! (They do when they're downloaded from NUS!)
        /// </summary>
        /// <param name="tik"></param>
        /// <param name="tmd"></param>
        /// <returns></returns>
        public static CertificateChain FromTikTmd(Stream tik, Stream tmd)
        {
            CertificateChain certificateChain = new CertificateChain();

            certificateChain.GrabFromTik(tik);
            certificateChain.GrabFromTmd(tmd);
            return(certificateChain);
        }