using System;
using System.Collections;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using System.Security.Permissions;
namespace System.Security.Policy
{
/// Defines the set of information that constitutes input to security policy decisions. This class cannot be inherited.
// Token: 0x02000587 RID: 1415
[ComVisible(true)]
[MonoTODO("Serialization format not compatible with .NET")]
[Serializable]
public sealed class Evidence : IEnumerable, ICollection
{
/// Initializes a new empty instance of the class.
// Token: 0x060033BE RID: 13246 RVA: 0x000B1F40 File Offset: 0x000B0140
public Evidence()
{
}
/// Initializes a new instance of the class from a shallow copy of an existing one.
/// The instance from which to create the new instance. This instance is not deep copied.
/// The parameter is not a valid instance of .
// Token: 0x060033BF RID: 13247 RVA: 0x000B1F48 File Offset: 0x000B0148
public Evidence(Evidence evidence)
{
if (evidence != null)
{
this.Merge(evidence);
}
}
/// Initializes a new instance of the class from multiple sets of host and assembly evidence.
/// The host evidence from which to create the new instance.
/// The assembly evidence from which to create the new instance.
// Token: 0x060033C0 RID: 13248 RVA: 0x000B1F60 File Offset: 0x000B0160
public Evidence(object[] hostEvidence, object[] assemblyEvidence)
{
if (hostEvidence != null)
{
this.HostEvidenceList.AddRange(hostEvidence);
}
if (assemblyEvidence != null)
{
this.AssemblyEvidenceList.AddRange(assemblyEvidence);
}
}
/// Gets the number of evidence objects in the evidence set.
/// The number of evidence objects in the evidence set.
// Token: 0x17000A32 RID: 2610
// (get) Token: 0x060033C1 RID: 13249 RVA: 0x000B1F98 File Offset: 0x000B0198
public int Count
{
get
{
int num = 0;
if (this.hostEvidenceList != null)
{
num += this.hostEvidenceList.Count;
}
if (this.assemblyEvidenceList != null)
{
num += this.assemblyEvidenceList.Count;
}
return num;
}
}
/// Gets a value indicating whether the evidence set is read-only.
/// Always false because read-only evidence sets are not supported.
// Token: 0x17000A33 RID: 2611
// (get) Token: 0x060033C2 RID: 13250 RVA: 0x000B1FDC File Offset: 0x000B01DC
public bool IsReadOnly
{
get
{
return false;
}
}
/// Gets a value indicating whether the evidence set is thread-safe.
/// Always false because thread-safe evidence sets are not supported.
// Token: 0x17000A34 RID: 2612
// (get) Token: 0x060033C3 RID: 13251 RVA: 0x000B1FE0 File Offset: 0x000B01E0
public bool IsSynchronized
{
get
{
return false;
}
}
/// Gets or sets a value indicating whether the evidence is locked.
/// true if the evidence is locked; otherwise, false. The default is false.
///
///
///
// Token: 0x17000A35 RID: 2613
// (get) Token: 0x060033C4 RID: 13252 RVA: 0x000B1FE4 File Offset: 0x000B01E4
// (set) Token: 0x060033C5 RID: 13253 RVA: 0x000B1FEC File Offset: 0x000B01EC
public bool Locked
{
get
{
return this._locked;
}
set
{
this._locked = value;
}
}
/// Gets the synchronization root.
/// Always this (Me in Visual Basic) because synchronization of evidence sets is not supported.
// Token: 0x17000A36 RID: 2614
// (get) Token: 0x060033C6 RID: 13254 RVA: 0x000B1FF8 File Offset: 0x000B01F8
public object SyncRoot
{
get
{
return this;
}
}
// Token: 0x17000A37 RID: 2615
// (get) Token: 0x060033C7 RID: 13255 RVA: 0x000B1FFC File Offset: 0x000B01FC
internal ArrayList HostEvidenceList
{
get
{
if (this.hostEvidenceList == null)
{
this.hostEvidenceList = ArrayList.Synchronized(new ArrayList());
}
return this.hostEvidenceList;
}
}
// Token: 0x17000A38 RID: 2616
// (get) Token: 0x060033C8 RID: 13256 RVA: 0x000B2020 File Offset: 0x000B0220
internal ArrayList AssemblyEvidenceList
{
get
{
if (this.assemblyEvidenceList == null)
{
this.assemblyEvidenceList = ArrayList.Synchronized(new ArrayList());
}
return this.assemblyEvidenceList;
}
}
/// Adds the specified assembly evidence to the evidence set.
/// Any evidence object.
// Token: 0x060033C9 RID: 13257 RVA: 0x000B2044 File Offset: 0x000B0244
public void AddAssembly(object id)
{
this.AssemblyEvidenceList.Add(id);
this._hashCode = 0;
}
/// Adds the specified evidence supplied by the host to the evidence set.
/// Any evidence object.
///
/// is true and the code that calls this method does not have .
///
///
///
// Token: 0x060033CA RID: 13258 RVA: 0x000B205C File Offset: 0x000B025C
public void AddHost(object id)
{
if (this._locked && SecurityManager.SecurityEnabled)
{
new SecurityPermission(SecurityPermissionFlag.ControlEvidence).Demand();
}
this.HostEvidenceList.Add(id);
this._hashCode = 0;
}
/// Removes the host and assembly evidence from the evidence set.
// Token: 0x060033CB RID: 13259 RVA: 0x000B20A0 File Offset: 0x000B02A0
[ComVisible(false)]
public void Clear()
{
if (this.hostEvidenceList != null)
{
this.hostEvidenceList.Clear();
}
if (this.assemblyEvidenceList != null)
{
this.assemblyEvidenceList.Clear();
}
this._hashCode = 0;
}
/// Copies evidence objects to an .
/// The target array to which to copy evidence objects.
/// The zero-based position in the array to which to begin copying evidence objects.
// Token: 0x060033CC RID: 13260 RVA: 0x000B20D8 File Offset: 0x000B02D8
public void CopyTo(Array array, int index)
{
int num = 0;
if (this.hostEvidenceList != null)
{
num = this.hostEvidenceList.Count;
if (num > 0)
{
this.hostEvidenceList.CopyTo(array, index);
}
}
if (this.assemblyEvidenceList != null && this.assemblyEvidenceList.Count > 0)
{
this.assemblyEvidenceList.CopyTo(array, index + num);
}
}
/// Determines whether the specified object is equal to the current .
/// true if the specified object is equal to the current ; otherwise, false.
/// The object to compare with the current .
// Token: 0x060033CD RID: 13261 RVA: 0x000B2140 File Offset: 0x000B0340
[ComVisible(false)]
public override bool Equals(object obj)
{
if (obj == null)
{
return false;
}
Evidence evidence = obj as Evidence;
if (evidence == null)
{
return false;
}
if (this.HostEvidenceList.Count != evidence.HostEvidenceList.Count)
{
return false;
}
if (this.AssemblyEvidenceList.Count != evidence.AssemblyEvidenceList.Count)
{
return false;
}
for (int i = 0; i < this.hostEvidenceList.Count; i++)
{
bool flag = false;
int j = 0;
while (j < evidence.hostEvidenceList.Count)
{
if (this.hostEvidenceList[i].Equals(evidence.hostEvidenceList[j]))
{
flag = true;
break;
}
i++;
}
if (!flag)
{
return false;
}
}
for (int k = 0; k < this.assemblyEvidenceList.Count; k++)
{
bool flag2 = false;
int l = 0;
while (l < evidence.assemblyEvidenceList.Count)
{
if (this.assemblyEvidenceList[k].Equals(evidence.assemblyEvidenceList[l]))
{
flag2 = true;
break;
}
k++;
}
if (!flag2)
{
return false;
}
}
return true;
}
/// Enumerates all evidence in the set, both that provided by the host and that provided by the assembly.
/// An enumerator for evidence added by both the method and the method.
// Token: 0x060033CE RID: 13262 RVA: 0x000B2284 File Offset: 0x000B0484
public IEnumerator GetEnumerator()
{
IEnumerator enumerator = null;
if (this.hostEvidenceList != null)
{
enumerator = this.hostEvidenceList.GetEnumerator();
}
IEnumerator enumerator2 = null;
if (this.assemblyEvidenceList != null)
{
enumerator2 = this.assemblyEvidenceList.GetEnumerator();
}
return new Evidence.EvidenceEnumerator(enumerator, enumerator2);
}
/// Enumerates evidence provided by the assembly.
/// An enumerator for evidence added by the method.
// Token: 0x060033CF RID: 13263 RVA: 0x000B22CC File Offset: 0x000B04CC
public IEnumerator GetAssemblyEnumerator()
{
return this.AssemblyEvidenceList.GetEnumerator();
}
/// Gets a hash code for the object that is suitable for use in hashing algorithms and data structures such as a hash table.
/// A hash code for the current object.
// Token: 0x060033D0 RID: 13264 RVA: 0x000B22DC File Offset: 0x000B04DC
[ComVisible(false)]
public override int GetHashCode()
{
if (this._hashCode == 0)
{
if (this.hostEvidenceList != null)
{
for (int i = 0; i < this.hostEvidenceList.Count; i++)
{
this._hashCode ^= this.hostEvidenceList[i].GetHashCode();
}
}
if (this.assemblyEvidenceList != null)
{
for (int j = 0; j < this.assemblyEvidenceList.Count; j++)
{
this._hashCode ^= this.assemblyEvidenceList[j].GetHashCode();
}
}
}
return this._hashCode;
}
/// Enumerates evidence supplied by the host.
/// An enumerator for evidence added by the method.
// Token: 0x060033D1 RID: 13265 RVA: 0x000B2384 File Offset: 0x000B0584
public IEnumerator GetHostEnumerator()
{
return this.HostEvidenceList.GetEnumerator();
}
/// Merges the specified evidence set into the current evidence set.
/// The evidence set to be merged into the current evidence set.
/// The parameter is not a valid instance of .
///
/// is true, the code that calls this method does not have , and the parameter has a host list that is not empty.
///
///
///
// Token: 0x060033D2 RID: 13266 RVA: 0x000B2394 File Offset: 0x000B0594
public void Merge(Evidence evidence)
{
if (evidence != null && evidence.Count > 0)
{
if (evidence.hostEvidenceList != null)
{
foreach (object obj in evidence.hostEvidenceList)
{
this.AddHost(obj);
}
}
if (evidence.assemblyEvidenceList != null)
{
foreach (object obj2 in evidence.assemblyEvidenceList)
{
this.AddAssembly(obj2);
}
}
this._hashCode = 0;
}
}
/// Removes the evidence for a given type from the host and assembly enumerations.
/// The of the evidence to be removed.
// Token: 0x060033D3 RID: 13267 RVA: 0x000B248C File Offset: 0x000B068C
[ComVisible(false)]
public void RemoveType(Type t)
{
for (int i = this.hostEvidenceList.Count; i >= 0; i--)
{
if (this.hostEvidenceList.GetType() == t)
{
this.hostEvidenceList.RemoveAt(i);
this._hashCode = 0;
}
}
for (int j = this.assemblyEvidenceList.Count; j >= 0; j--)
{
if (this.assemblyEvidenceList.GetType() == t)
{
this.assemblyEvidenceList.RemoveAt(j);
this._hashCode = 0;
}
}
}
// Token: 0x060033D4 RID: 13268
[MethodImpl(MethodImplOptions.InternalCall)]
private static extern bool IsAuthenticodePresent(Assembly a);
// Token: 0x060033D5 RID: 13269 RVA: 0x000B251C File Offset: 0x000B071C
internal static Evidence GetDefaultHostEvidence(Assembly a)
{
return new Evidence();
}
// Token: 0x04001548 RID: 5448
private bool _locked;
// Token: 0x04001549 RID: 5449
private ArrayList hostEvidenceList;
// Token: 0x0400154A RID: 5450
private ArrayList assemblyEvidenceList;
// Token: 0x0400154B RID: 5451
private int _hashCode;
// Token: 0x02000588 RID: 1416
private class EvidenceEnumerator : IEnumerator
{
// Token: 0x060033D6 RID: 13270 RVA: 0x000B2524 File Offset: 0x000B0724
public EvidenceEnumerator(IEnumerator hostenum, IEnumerator assemblyenum)
{
this.hostEnum = hostenum;
this.assemblyEnum = assemblyenum;
this.currentEnum = this.hostEnum;
}
// Token: 0x060033D7 RID: 13271 RVA: 0x000B2554 File Offset: 0x000B0754
public bool MoveNext()
{
if (this.currentEnum == null)
{
return false;
}
bool flag = this.currentEnum.MoveNext();
if (!flag && this.hostEnum == this.currentEnum && this.assemblyEnum != null)
{
this.currentEnum = this.assemblyEnum;
flag = this.assemblyEnum.MoveNext();
}
return flag;
}
// Token: 0x060033D8 RID: 13272 RVA: 0x000B25B8 File Offset: 0x000B07B8
public void Reset()
{
if (this.hostEnum != null)
{
this.hostEnum.Reset();
this.currentEnum = this.hostEnum;
}
else
{
this.currentEnum = this.assemblyEnum;
}
if (this.assemblyEnum != null)
{
this.assemblyEnum.Reset();
}
}
// Token: 0x17000A39 RID: 2617
// (get) Token: 0x060033D9 RID: 13273 RVA: 0x000B2610 File Offset: 0x000B0810
public object Current
{
get
{
return this.currentEnum.Current;
}
}
// Token: 0x0400154C RID: 5452
private IEnumerator currentEnum;
// Token: 0x0400154D RID: 5453
private IEnumerator hostEnum;
// Token: 0x0400154E RID: 5454
private IEnumerator assemblyEnum;
}
}
}