Esempio n. 1
0
 public void Write(LicenseDat dat)
 {
     Write(0x52494600); // "RIF\0";
     Write(dat.Version);
     Write(dat.Unknown);
     Write(dat.PsnAccountId);
     Write(dat.StartTime);
     Write(dat.EndTime);
     Write(Encoding.ASCII.GetBytes(dat.ContentId));
     Write(new byte[12]);
     Write((short)dat.LicenseType);
     Write((short)dat.DrmType);
     Write((short)dat.ContentType);
     Write(dat.SkuFlag);
     Write(dat.Flags);
     Write(dat.Unk_5C);
     Write(dat.Unk_60);
     Write(dat.Unk_64);
     Write(dat.Unk_Flag);
     s.Position += 468;
     Write(dat.DiscKey);
     Write(dat.SecretIv);
     Write(dat.Secret);
     Write(dat.Signature);
 }
Esempio n. 2
0
        public LicenseDat Read()
        {
            if (Int() != 0x52494600)
            {
                throw new Exception("License did not have expected RIF header");
            }
            var license = new LicenseDat()
            {
                Version      = Short(),
                Unknown      = Short(),
                PsnAccountId = ULong(),
                StartTime    = Long(),
                EndTime      = Long(),
                ContentId    = Encoding.ASCII.GetString(ReadBytes(48)).Substring(0, 36),
                LicenseType  = (LicenseType)Short(),
                DrmType      = (DrmType)Short(),
                ContentType  = (ContentType)Short(),
                SkuFlag      = Short(),
                Flags        = Int(),
                Unk_5C       = Int(),
                Unk_60       = Int(),
                Unk_64       = Int(),
                Unk_Flag     = Int(),
            };

            s.Position       += 468;
            license.DiscKey   = ReadBytes(32);
            license.SecretIv  = ReadBytes(16);
            license.Secret    = ReadBytes(144);
            license.Signature = ReadBytes(256);
            return(license);
        }