Example #1
0
        public static uint sceNpDrmGetFixedKey(ref byte key, ref string npstr, int type)
        {
            Crypto.AES_ctx akey   = new Crypto.AES_ctx();
            Crypto.MAC_KEY mkey   = new Crypto.MAC_KEY();
            string         strbuf = new string(new char[0x30]);
            int            retv;

            if ((type & 0x01000000) == 0)
            {
                return(0x80550901);
            }

            type &= 0x000000ff;

            strbuf = npstr.Substring(0, 0x30);

            retv = sceDrmBBMacInit(mkey, 1);

            if (retv != 0)
            {
                return((uint)retv);
            }

            //retv = sceDrmBBMacUpdate(mkey, (byte)strbuf, 0x30);

            //if (retv != 0)
            //{
            //    return retv;
            //}

            //retv = sceDrmBBMacFinal(mkey, ref key, npdrm_fixed_key);

            if (retv != 0)
            {
                return(0x80550902);
            }

            if (type == 0)
            {
                return(0);
            }
            if (type > 3)
            {
                return(0x80550901);
            }

            type = (type - 1) * 16;

            // Crypto.AES_set_key(akey, npdrm_enc_keys[type], 128);
            //   Crypto.AES_encrypt(akey, key, ref key);

            return(0);
        }