当前位置: 首页>>代码示例>>C#>>正文


C# SecurityContextSource类代码示例

本文整理汇总了C#中SecurityContextSource的典型用法代码示例。如果您正苦于以下问题:C# SecurityContextSource类的具体用法?C# SecurityContextSource怎么用?C# SecurityContextSource使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


SecurityContextSource类属于命名空间,在下文中一共展示了SecurityContextSource类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: InternalDefineDynamicAssembly

 [MethodImplAttribute(MethodImplOptions.NoInlining)] // Methods containing StackCrawlMark local var has to be marked non-inlineable
 private AssemblyBuilder InternalDefineDynamicAssembly(
     AssemblyName name,
     AssemblyBuilderAccess access,
     String dir,
     Evidence evidence,
     PermissionSet requiredPermissions,
     PermissionSet optionalPermissions,
     PermissionSet refusedPermissions,
     ref StackCrawlMark stackMark,
     IEnumerable<CustomAttributeBuilder> assemblyAttributes,
     SecurityContextSource securityContextSource)
 {
     return AssemblyBuilder.InternalDefineDynamicAssembly(name,
                                                          access,
                                                          dir,
                                                          evidence,
                                                          requiredPermissions,
                                                          optionalPermissions,
                                                          refusedPermissions,
                                                          ref stackMark,
                                                          assemblyAttributes,
                                                          securityContextSource);
 }
开发者ID:Rayislandstyle,项目名称:dotnet-coreclr,代码行数:24,代码来源:AppDomain.cs

示例2: Load

        [MethodImpl(MethodImplOptions.NoInlining)]  // Due to the stack crawl mark
        public static Assembly Load(byte[] rawAssembly,
                                    byte[] rawSymbolStore,
                                    SecurityContextSource securityContextSource)
        {

            Contract.Ensures(Contract.Result<Assembly>() != null);
            Contract.Ensures(!Contract.Result<Assembly>().ReflectionOnly);

            AppDomain.CheckLoadByteArraySupported();

            if (securityContextSource < SecurityContextSource.CurrentAppDomain ||
                securityContextSource > SecurityContextSource.CurrentAssembly)
            {
                throw new ArgumentOutOfRangeException("securityContextSource");
            }

            StackCrawlMark stackMark = StackCrawlMark.LookForMyCaller;
            return RuntimeAssembly.nLoadImage(rawAssembly,
                                              rawSymbolStore,
                                              null,             // evidence
                                              ref stackMark,
                                              false,            // fIntrospection
                                              securityContextSource);
        }
开发者ID:afrog33k,项目名称:csnative,代码行数:25,代码来源:Assembly.cs

示例3: DefineDynamicAssembly

        public AssemblyBuilder DefineDynamicAssembly(AssemblyName name,
                                                     AssemblyBuilderAccess access,
                                                     IEnumerable<CustomAttributeBuilder> assemblyAttributes,
                                                     SecurityContextSource securityContextSource)
        {
            Contract.Ensures(Contract.Result<AssemblyBuilder>() != null);

            StackCrawlMark stackMark = StackCrawlMark.LookForMyCaller;
            return InternalDefineDynamicAssembly(name,
                                                 access,
                                                 null, null, null, null, null,
                                                 ref stackMark,
                                                 assemblyAttributes,
                                                 securityContextSource);
        }
开发者ID:Rayislandstyle,项目名称:dotnet-coreclr,代码行数:15,代码来源:AppDomain.cs

示例4: Load

		public static Assembly Load (byte [] rawAssembly, byte [] rawSymbolStore, SecurityContextSource securityContextSource)
		{
			return AppDomain.CurrentDomain.Load (rawAssembly, rawSymbolStore);
		}
开发者ID:RainsSoft,项目名称:SharpLang,代码行数:4,代码来源:Assembly.cs

示例5: nLoadImage

 static internal extern RuntimeAssembly nLoadImage(byte[] rawAssembly,
                                                   byte[] rawSymbolStore,
                                                   Evidence evidence,
                                                   ref StackCrawlMark stackMark,
                                                   bool fIntrospection,
                                                   SecurityContextSource securityContextSource);
开发者ID:afrog33k,项目名称:csnative,代码行数:6,代码来源:Assembly.cs

示例6: Load

 public IAssembly Load(byte[] rawAssembly, byte[] rawSymbolStore, SecurityContextSource securityContextSource)
 {
     return new AssemblyWrap(Assembly.Load(rawAssembly, rawSymbolStore, securityContextSource));
 }
开发者ID:CosminLazar,项目名称:SystemWrapper,代码行数:4,代码来源:AssemblySystem.cs

示例7: DefineDynamicAssembly

		public AssemblyBuilder DefineDynamicAssembly (AssemblyName name, AssemblyBuilderAccess access, IEnumerable<CustomAttributeBuilder> assemblyAttributes, SecurityContextSource securityContextSource)
		{
			return DefineDynamicAssembly (name, access, assemblyAttributes);
		}
开发者ID:rabink,项目名称:mono,代码行数:4,代码来源:AppDomain.cs

示例8: nCreateDynamicAssembly

 private static extern Assembly nCreateDynamicAssembly(AppDomain domain,
                                                       AssemblyName name,
                                                       Evidence identity,
                                                       ref StackCrawlMark stackMark,
                                                       PermissionSet requiredPermissions,
                                                       PermissionSet optionalPermissions,
                                                       PermissionSet refusedPermissions,
                                                       byte[] securityRulesBlob,
                                                       byte[] aptcaBlob,
                                                       AssemblyBuilderAccess access,
                                                       DynamicAssemblyFlags flags,
                                                       SecurityContextSource securityContextSource);
开发者ID:ChuangYang,项目名称:coreclr,代码行数:12,代码来源:AssemblyBuilder.cs

示例9: InternalDefineDynamicAssembly

        [System.Security.SecurityCritical]  // auto-generated
        internal static AssemblyBuilder InternalDefineDynamicAssembly(
            AssemblyName name,
            AssemblyBuilderAccess access,
            String dir,
            Evidence evidence,
            PermissionSet requiredPermissions,
            PermissionSet optionalPermissions,
            PermissionSet refusedPermissions,
            ref StackCrawlMark stackMark,
            IEnumerable<CustomAttributeBuilder> unsafeAssemblyAttributes,
            SecurityContextSource securityContextSource)
        {
#if FEATURE_CAS_POLICY
            if (evidence != null && !AppDomain.CurrentDomain.IsLegacyCasPolicyEnabled)
            {
                throw new NotSupportedException(Environment.GetResourceString("NotSupported_RequiresCasPolicyExplicit"));
            }
#endif // FEATURE_CAS_POLICY

            lock (typeof(AssemblyBuilderLock))
            {
                // we can only create dynamic assemblies in the current domain
                return new AssemblyBuilder(AppDomain.CurrentDomain,
                                           name,
                                           access,
                                           dir,
                                           evidence,
                                           requiredPermissions,
                                           optionalPermissions,
                                           refusedPermissions,
                                           ref stackMark,
                                           unsafeAssemblyAttributes,
                                           securityContextSource);
            } //lock(typeof(AssemblyBuilderLock))
        }
开发者ID:ChuangYang,项目名称:coreclr,代码行数:36,代码来源:AssemblyBuilder.cs

示例10: Load

        [MethodImpl(MethodImplOptions.NoInlining)]  // Due to the stack crawl mark
        public static Assembly Load(byte[] rawAssembly,
                                    byte[] rawSymbolStore,
                                    SecurityContextSource securityContextSource) 
        {
            if (securityContextSource < SecurityContextSource.CurrentAppDomain || 
                securityContextSource > SecurityContextSource.CurrentAssembly) 
            {
                throw new ArgumentOutOfRangeException("securityContextSource"); 
            }

            StackCrawlMark stackMark = StackCrawlMark.LookForMyCaller;
            return RuntimeAssembly.nLoadImage(rawAssembly, 
                                              rawSymbolStore,
                                              null,             // evidence 
                                              ref stackMark, 
                                              false,            // fIntrospection
                                              securityContextSource); 
        }
开发者ID:sjyanxin,项目名称:WPFSource,代码行数:19,代码来源:Assembly.cs

示例11: AssemblyBuilder

        [System.Security.SecurityCritical]  // auto-generated
        internal AssemblyBuilder(AppDomain domain,
                                 AssemblyName name,
                                 AssemblyBuilderAccess access,
                                 String dir,
                                 Evidence evidence,
                                 PermissionSet requiredPermissions,
                                 PermissionSet optionalPermissions,
                                 PermissionSet refusedPermissions,
                                 ref StackCrawlMark stackMark,
                                 IEnumerable<CustomAttributeBuilder> unsafeAssemblyAttributes,
                                 SecurityContextSource securityContextSource)
        {
            if (name == null)
                throw new ArgumentNullException("name");

            if (access != AssemblyBuilderAccess.Run
#if !FEATURE_CORECLR
                && access != AssemblyBuilderAccess.Save
                && access != AssemblyBuilderAccess.RunAndSave
#endif // !FEATURE_CORECLR
#if FEATURE_REFLECTION_ONLY_LOAD
                && access != AssemblyBuilderAccess.ReflectionOnly
#endif // FEATURE_REFLECTION_ONLY_LOAD
#if FEATURE_COLLECTIBLE_TYPES
                && access != AssemblyBuilderAccess.RunAndCollect
#endif // FEATURE_COLLECTIBLE_TYPES
                )
            {
                throw new ArgumentException(Environment.GetResourceString("Arg_EnumIllegalVal", (int)access), "access");
            }

            if (securityContextSource < SecurityContextSource.CurrentAppDomain ||
                securityContextSource > SecurityContextSource.CurrentAssembly)
            {
                throw new ArgumentOutOfRangeException("securityContextSource");
            }

            // Clone the name in case the caller modifies it underneath us.
            name = (AssemblyName)name.Clone();
            
#if !FEATURE_CORECLR
            // Set the public key from the key pair if one has been provided.
            // (Overwite any public key in the Assembly name, since it's no
            // longer valid to have a disparity).
            if (name.KeyPair != null)
                name.SetPublicKey(name.KeyPair.PublicKey);
#endif

            // If the caller is trusted they can supply identity
            // evidence for the new assembly. Otherwise we copy the
            // current grant and deny sets from the caller's assembly,
            // inject them into the new assembly and mark policy as
            // resolved. If/when the assembly is persisted and
            // reloaded, the normal rules for gathering evidence will
            // be used.
            if (evidence != null)
#pragma warning disable 618
                new SecurityPermission(SecurityPermissionFlag.ControlEvidence).Demand();
#pragma warning restore 618

#if FEATURE_COLLECTIBLE_TYPES && !FEATURE_CORECLR
            // Collectible assemblies require FullTrust. This demand may be removed if we deem the
            // feature robust enough to be used directly by untrusted API consumers.
            if (access == AssemblyBuilderAccess.RunAndCollect)
                new PermissionSet(PermissionState.Unrestricted).Demand();
#endif // FEATURE_COLLECTIBLE_TYPES && !FEATURE_CORECLR

            // Scan the assembly level attributes for any attributes which modify how we create the
            // assembly. Currently, we look for any attribute which modifies the security transparency
            // of the assembly.
            List<CustomAttributeBuilder> assemblyAttributes = null;
            DynamicAssemblyFlags assemblyFlags = DynamicAssemblyFlags.None;
            byte[] securityRulesBlob = null;
            byte[] aptcaBlob = null;
            if (unsafeAssemblyAttributes != null)
            {
                // Create a copy to ensure that it cannot be modified from another thread
                // as it is used further below.
                assemblyAttributes = new List<CustomAttributeBuilder>(unsafeAssemblyAttributes);

#pragma warning disable 618 // We deal with legacy attributes here as well for compat
                foreach (CustomAttributeBuilder attribute in assemblyAttributes)
                {
                    if (attribute.m_con.DeclaringType == typeof(SecurityTransparentAttribute))
                    {
                        assemblyFlags |= DynamicAssemblyFlags.Transparent;
                    }
                    else if (attribute.m_con.DeclaringType == typeof(SecurityCriticalAttribute))
                    {
#if !FEATURE_CORECLR
                        SecurityCriticalScope scope = SecurityCriticalScope.Everything;
                        if (attribute.m_constructorArgs != null &&
                            attribute.m_constructorArgs.Length == 1 &&
                            attribute.m_constructorArgs[0] is SecurityCriticalScope)
                        {
                            scope = (SecurityCriticalScope)attribute.m_constructorArgs[0];
                        }

                        assemblyFlags |= DynamicAssemblyFlags.Critical;
//.........这里部分代码省略.........
开发者ID:ChuangYang,项目名称:coreclr,代码行数:101,代码来源:AssemblyBuilder.cs

示例12: DefineDynamicAssembly

		public AssemblyBuilder DefineDynamicAssembly(AssemblyName name, AssemblyBuilderAccess access, IEnumerable<CustomAttributeBuilder> assemblyAttributes, SecurityContextSource securityContextSource)
		{
			StackCrawlMark stackCrawlMark = StackCrawlMark.LookForMyCaller;
			return this.InternalDefineDynamicAssembly(name, access, null, null, null, null, null, ref stackCrawlMark, assemblyAttributes, securityContextSource);
		}
开发者ID:ChristianWulf,项目名称:CSharpKDMDiscoverer,代码行数:5,代码来源:AppDomain.cs

示例13: InternalDefineDynamicAssembly

 internal static AssemblyBuilder InternalDefineDynamicAssembly(AssemblyName name, AssemblyBuilderAccess access, string dir, System.Security.Policy.Evidence evidence, System.Security.PermissionSet requiredPermissions, System.Security.PermissionSet optionalPermissions, System.Security.PermissionSet refusedPermissions, ref StackCrawlMark stackMark, IEnumerable<CustomAttributeBuilder> unsafeAssemblyAttributes, SecurityContextSource securityContextSource)
 {
     if ((evidence != null) && !AppDomain.CurrentDomain.IsLegacyCasPolicyEnabled)
     {
         throw new NotSupportedException(Environment.GetResourceString("NotSupported_RequiresCasPolicyExplicit"));
     }
     lock (typeof(AssemblyBuilderLock))
     {
         return new AssemblyBuilder(AppDomain.CurrentDomain, name, access, dir, evidence, requiredPermissions, optionalPermissions, refusedPermissions, ref stackMark, unsafeAssemblyAttributes, securityContextSource);
     }
 }
开发者ID:pritesh-mandowara-sp,项目名称:DecompliedDotNetLibraries,代码行数:11,代码来源:AssemblyBuilder.cs

示例14: AssemblyBuilder

 internal AssemblyBuilder(AppDomain domain, AssemblyName name, AssemblyBuilderAccess access, string dir, System.Security.Policy.Evidence evidence, System.Security.PermissionSet requiredPermissions, System.Security.PermissionSet optionalPermissions, System.Security.PermissionSet refusedPermissions, ref StackCrawlMark stackMark, IEnumerable<CustomAttributeBuilder> unsafeAssemblyAttributes, SecurityContextSource securityContextSource)
 {
     if (name == null)
     {
         throw new ArgumentNullException("name");
     }
     if ((((access != AssemblyBuilderAccess.Run) && (access != AssemblyBuilderAccess.Save)) && ((access != AssemblyBuilderAccess.RunAndSave) && (access != AssemblyBuilderAccess.ReflectionOnly))) && (access != AssemblyBuilderAccess.RunAndCollect))
     {
         throw new ArgumentException(Environment.GetResourceString("Arg_EnumIllegalVal", new object[] { (int) access }), "access");
     }
     if ((securityContextSource < SecurityContextSource.CurrentAppDomain) || (securityContextSource > SecurityContextSource.CurrentAssembly))
     {
         throw new ArgumentOutOfRangeException("securityContextSource");
     }
     if (name.KeyPair != null)
     {
         name.SetPublicKey(name.KeyPair.PublicKey);
     }
     if (evidence != null)
     {
         new SecurityPermission(SecurityPermissionFlag.ControlEvidence).Demand();
     }
     if (access == AssemblyBuilderAccess.RunAndCollect)
     {
         new System.Security.PermissionSet(PermissionState.Unrestricted).Demand();
     }
     List<CustomAttributeBuilder> list = null;
     DynamicAssemblyFlags none = DynamicAssemblyFlags.None;
     byte[] destinationArray = null;
     byte[] buffer2 = null;
     if (unsafeAssemblyAttributes != null)
     {
         list = new List<CustomAttributeBuilder>(unsafeAssemblyAttributes);
         foreach (CustomAttributeBuilder builder in list)
         {
             if (builder.m_con.DeclaringType == typeof(SecurityTransparentAttribute))
             {
                 none |= DynamicAssemblyFlags.Transparent;
             }
             else if (builder.m_con.DeclaringType == typeof(SecurityCriticalAttribute))
             {
                 SecurityCriticalScope everything = SecurityCriticalScope.Everything;
                 if (((builder.m_constructorArgs != null) && (builder.m_constructorArgs.Length == 1)) && (builder.m_constructorArgs[0] is SecurityCriticalScope))
                 {
                     everything = (SecurityCriticalScope) builder.m_constructorArgs[0];
                 }
                 none |= DynamicAssemblyFlags.Critical;
                 if (everything == SecurityCriticalScope.Everything)
                 {
                     none |= DynamicAssemblyFlags.AllCritical;
                 }
             }
             else if (builder.m_con.DeclaringType == typeof(SecurityRulesAttribute))
             {
                 destinationArray = new byte[builder.m_blob.Length];
                 Array.Copy(builder.m_blob, destinationArray, destinationArray.Length);
             }
             else if (builder.m_con.DeclaringType == typeof(SecurityTreatAsSafeAttribute))
             {
                 none |= DynamicAssemblyFlags.TreatAsSafe;
             }
             else if (builder.m_con.DeclaringType == typeof(AllowPartiallyTrustedCallersAttribute))
             {
                 none |= DynamicAssemblyFlags.Aptca;
                 buffer2 = new byte[builder.m_blob.Length];
                 Array.Copy(builder.m_blob, buffer2, buffer2.Length);
             }
         }
     }
     this.m_internalAssemblyBuilder = (InternalAssemblyBuilder) nCreateDynamicAssembly(domain, name, evidence, ref stackMark, requiredPermissions, optionalPermissions, refusedPermissions, destinationArray, buffer2, access, none, securityContextSource);
     this.m_assemblyData = new AssemblyBuilderData(this.m_internalAssemblyBuilder, name.Name, access, dir);
     this.m_assemblyData.AddPermissionRequests(requiredPermissions, optionalPermissions, refusedPermissions);
     this.InitManifestModule();
     if (list != null)
     {
         foreach (CustomAttributeBuilder builder2 in list)
         {
             this.SetCustomAttribute(builder2);
         }
     }
 }
开发者ID:pritesh-mandowara-sp,项目名称:DecompliedDotNetLibraries,代码行数:81,代码来源:AssemblyBuilder.cs

示例15: InternalDefineDynamicAssembly

 internal static AssemblyBuilder InternalDefineDynamicAssembly(
     AssemblyName name,
     AssemblyBuilderAccess access,
     String dir,
     Evidence evidence,
     PermissionSet requiredPermissions,
     PermissionSet optionalPermissions,
     PermissionSet refusedPermissions,
     ref StackCrawlMark stackMark,
     IEnumerable<CustomAttributeBuilder> unsafeAssemblyAttributes,
     SecurityContextSource securityContextSource)
 {
     lock (typeof(AssemblyBuilderLock))
     {
         // we can only create dynamic assemblies in the current domain
         return new AssemblyBuilder(AppDomain.CurrentDomain,
                                    name,
                                    access,
                                    dir,
                                    evidence,
                                    requiredPermissions,
                                    optionalPermissions,
                                    refusedPermissions,
                                    ref stackMark,
                                    unsafeAssemblyAttributes,
                                    securityContextSource);
     } //lock(typeof(AssemblyBuilderLock))
 }
开发者ID:kouvel,项目名称:coreclr,代码行数:28,代码来源:AssemblyBuilder.cs


注:本文中的SecurityContextSource类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。