Name

Hash

Synopsis

public sealed class Hash : System.Runtime.Serialization.ISerializable, IBuiltInEvidence {
// Public Constructors
   public Hash(System.Reflection.Assembly assembly);
// Public Instance Properties
   public byte[  ] MD5{get; }
   public byte[  ] SHA1{get; }
// Public Instance Methods
   public byte[  ] GenerateHash(System.Security.Cryptography.HashAlgorithm hashAlg);
   public void GetObjectData(System.Runtime.Serialization.SerializationInfo info, 
        System.Runtime.Serialization.StreamingContext context);
 // implements ISerializable
   public override string ToString(  );    
// overrides object
}

The Hash evidence class represents the hash value of an assembly’s content. Unlike the other standard evidence classes, Hash provides multiple evidence values (hash values) from a single set of source data. The evidence data source is a System.Reflection.Assembly object that is passed to the Hash object constructor. The MD5 and SHA1 properties calculate and return the MD5 and SHA1 hash values for the content of the Assembly. The GenerateHash( ) method allows any hashing implementation that derives from System.Security.Cryptography.HashAlgorithm to be used to generate a hash value of the Assembly content.

During policy resolution, the HashMembershipCondition class uses Hash evidence to evaluate whether code qualifies for membership of a CodeGroup.

Get Programming .NET Security now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.