[ Team LiB ] Previous Section Next Section

HashMembershipConditionserializable

System.Security.Policy (mscorlib.dll)sealed class
public sealed class HashMembershipCondition : IMembershipCondition, 
     System.Security.ISecurityEncodable, System.Security.ISecurityPolicyEncodable {
// Public Constructors
   public HashMembershipCondition(System.Security.Cryptography.HashAlgorithm hashAlg, byte[  ] value);
// Public Instance Properties
   public HashAlgorithm HashAlgorithm{set; get; }
   public byte[  ] HashValue{set; get; }
// Public Instance Methods
   public bool Check(Evidence evidence);
// implements IMembershipCondition
   public IMembershipCondition Copy(  );   
// implements IMembershipCondition
   public override bool Equals(object o);        
// overrides object
   public void FromXml(System.Security.SecurityElement e);
// implements System.Security.ISecurityEncodable
   public void FromXml(System.Security.SecurityElement e, PolicyLevel level);
 // implements System.Security.ISecurityPolicyEncodable
   public override int GetHashCode(  );    
// overrides object
   public override string ToString(  );    
// overrides object
   public SecurityElement ToXml(  );       
// implements System.Security.ISecurityEncodable
   public SecurityElement ToXml(PolicyLevel level);       
// implements System.Security.ISecurityPolicyEncodable
}

This membership condition class uses the value of Hash evidence to determine if an assembly or application domain qualifies for membership of a CodeGroup. The HashValue property contains the hash value required for membership, and the HashAlgorithm property contains a System.Security.Cryptography.HashAlgorithm object that implements the hash algorithm used to calculate the hash value.

When policy resolution calls the Check( ) method, if the provided Evidence collection contains a Hash object, the HashMembershipCondition object calls the Hash.GenerateHash( ) method and passes the System.Security.Cryptography.HashAlgorithm object from its HashAlgorithm property. If the returned hash value matches its HashValue property, then CodeGroup membership is granted.

    [ Team LiB ] Previous Section Next Section