private SSP.SecurityAttribute CreateSecurityAttribute(SecurityAction action, BinaryReader br, byte [] permset, int pos, out int start, bool resolve)
        {
            string cname   = SignatureReader.ReadUTF8String(permset, pos, out start);
            Type   secattr = null;

            // note: the SecurityAction parameter isn't important to generate the XML
            SSP.SecurityAttribute sa = null;
            try {
                secattr = Type.GetType(cname, false);
                if (secattr == null)
                {
                    return(null);
                }

                sa = Activator.CreateInstance(secattr, new object [] { (SSP.SecurityAction)action }) as SSP.SecurityAttribute;
            } catch {}

            if (sa == null)
            {
                return(null);
            }

            // encoded length of all parameters (we don't need the value - except the updated pos)
            Utilities.ReadCompressedInteger(permset, start, out pos);
            int numparams = Utilities.ReadCompressedInteger(permset, pos, out start);

            if (numparams == 0)
            {
                return(sa);
            }

            br.BaseStream.Position = start;
            for (int j = 0; j < numparams; j++)
            {
                bool read = true;
                CustomAttrib.NamedArg na = sr.ReadNamedArg(permset, br, ref read, resolve);
                if (!read)
                {
                    return(null);
                }

                if (na.Field)
                {
                    FieldInfo fi = secattr.GetField(na.FieldOrPropName);
                    fi.SetValue(sa, na.FixedArg.Elems[0].Value);
                }
                else if (na.Property)
                {
                    PropertyInfo pi = secattr.GetProperty(na.FieldOrPropName);
                    pi.SetValue(sa, na.FixedArg.Elems[0].Value, null);
                }
            }

            start = (int)br.BaseStream.Position;

            return(sa);
        }