[ Team LiB ] Previous Section Next Section

EvidenceCF 1.0, serializable

System.Security.Policy (mscorlib.dll)sealed class
public sealed class Evidence : ICollection, IEnumerable {
// Public Constructors
   public Evidence(  );
   public Evidence(Evidence evidence);
   public Evidence(object[  ] hostEvidence, object[  ] assemblyEvidence);
// Public Instance Properties
   public int Count{get; }      
// implements ICollection
   public bool IsReadOnly{get; }
   public bool IsSynchronized{get; }     
// implements ICollection
   public bool Locked{set; get; }
   public object SyncRoot{get; }
// implements ICollection
// Public Instance Methods
   public void AddAssembly(object id);
   public void AddHost(object id);
   public void CopyTo(Array array, int index);   
// implements ICollection
   public IEnumerator GetAssemblyEnumerator(  );
   public IEnumerator GetEnumerator(  );   
// implements IEnumerable
   public IEnumerator GetHostEnumerator(  );
   public void Merge(Evidence evidence);
}

The Evidence class is a specialized collection used to contain evidence objects. The Evidence class actually contains two sets of evidence objects: a collection of host evidence and a collection of assembly evidence. Host evidence is the primary type of evidence used as input by the runtime to drive security policy resolution. The runtime, or possibly a trusted host, specifies the host evidence. Host evidence is added to the Evidence collection using the AddHost( ) method and accessed through the GetHostEnumerator( ) method.

Assembly evidence is normally specified at build time by the assembly developer and embedded in the assembly file as a serialized resource. As the runtime loads the assembly, it deserializes any assembly evidence and places it inside the assembly's Evidence collection. A trusted host can also provide assembly evidence when it loads an assembly using the AddAssembly( ) method, although this is uncommon. The GetAssemblyEnumerator( ) method provides access to the assembly evidence contained in an Evidence collection.

Despite containing two separate collections, Evidence also provides members to manipulate the combined contents of both collections at once. The Count property returns the total number of evidence objects, and the GetEnumerator( ) method returns a System.Collections.IEnumerator that enumerates across all objects in the Evidence collection.

During policy resolution, the Evidence collection of an assembly or application domain is passed to each CodeGroup through the CodeGroup.Resolve( ) method. The CodeGroup then passes the Evidence collection to the IMembershipCondition.Check( ) method of its membership condition object. The membership condition evaluates the Evidence collection to determine if it contains the appropriate evidence values to qualify for CodeGroup membership.

Returned By

System.AppDomain.Evidence, System.Reflection.Assembly.Evidence, System.Security.IEvidenceFactory.Evidence, System.Xml.XmlSecureResolver.CreateEvidenceForUrl( )

Passed To

Multiple types

    [ Team LiB ] Previous Section Next Section