Inheritance: System.ComponentModel.LicenseContext
        internal static void Deserialize(Stream o, string cryptoKey, RuntimeLicenseContext context)
        {
            IFormatter formatter = new BinaryFormatter();

            object obj;

            new SecurityPermission(SecurityPermissionFlag.SerializationFormatter).PermitOnly();
            new SecurityPermission(SecurityPermissionFlag.SerializationFormatter).Assert();
            try {
                obj = formatter.Deserialize(o);
            }
            finally {
                CodeAccessPermission.RevertAssert();
                CodeAccessPermission.RevertPermitOnly();
            }

            if (obj is object[])
            {
                object[] value = (object[])obj;
                if (value[0] is string && (string)value[0] == cryptoKey)
                {
                    context.savedLicenseKeys = (Hashtable)value[1];
                }
            }
        }
Example #2
0
        [SuppressMessage("Microsoft.Security", "CA2107:ReviewDenyAndPermitOnlyUsage")] // Use of PermitOnly here is appropriate. This was a previous war-approved security 
        internal static void Deserialize(Stream o, string cryptoKey, RuntimeLicenseContext context) {
            IFormatter formatter = new BinaryFormatter();

            object obj = formatter.Deserialize(o);

            if (obj is object[]) {
                object[] value = (object[])obj;
                if (value[0] is string && (string)value[0] == cryptoKey) {
                    context.savedLicenseKeys = (Hashtable)value[1];
                }
            }
        }
 internal static void Deserialize(Stream o, string cryptoKey, RuntimeLicenseContext context)
 {
     IFormatter formatter = new BinaryFormatter();
     object obj2 = formatter.Deserialize(o);
     if (obj2 is object[])
     {
         object[] objArray = (object[]) obj2;
         if ((objArray[0] is string) && (((string) objArray[0]) == cryptoKey))
         {
             context.savedLicenseKeys = (Hashtable) objArray[1];
         }
     }
 }
Example #4
0
        internal static void Deserialize(Stream o, string cryptoKey, RuntimeLicenseContext context)
        {
            IFormatter formatter = new BinaryFormatter();
            object     obj2      = formatter.Deserialize(o);

            if (obj2 is object[])
            {
                object[] objArray = (object[])obj2;
                if ((objArray[0] is string) && (((string)objArray[0]) == cryptoKey))
                {
                    context.savedLicenseKeys = (Hashtable)objArray[1];
                }
            }
        }
        internal static void Deserialize(Stream o, string cryptoKey, RuntimeLicenseContext context)
        {
#pragma warning disable SYSLIB0011 // Issue https://github.com/dotnet/runtime/issues/39293 tracks finding an alternative to BinaryFormatter
            IFormatter formatter = new BinaryFormatter();

            object obj = formatter.Deserialize(o);
#pragma warning restore SYSLIB0011

            if (obj is object[] value)
            {
                if (value[0] is string && (string)value[0] == cryptoKey)
                {
                    context._savedLicenseKeys = (Hashtable)value[1];
                }
            }
        }