using System;
using System.Runtime.InteropServices;
using System.Security.Permissions;
namespace System.Security.Policy
{
/// Provides the strong name of a code assembly as evidence for policy evaluation. This class cannot be inherited.
// Token: 0x020005A0 RID: 1440
[ComVisible(true)]
[Serializable]
public sealed class StrongName : IBuiltInEvidence, IIdentityPermissionFactory
{
/// Initializes a new instance of the class with the strong name public key blob, name, and version.
/// The of the software publisher.
/// The simple name section of the strong name.
/// The of the strong name.
/// The parameter is null.-or- The parameter is null.-or- The parameter is null.
/// The parameter is an empty string ("").
// Token: 0x060034B0 RID: 13488 RVA: 0x000B5BF0 File Offset: 0x000B3DF0
public StrongName(StrongNamePublicKeyBlob blob, string name, Version version)
{
if (blob == null)
{
throw new ArgumentNullException("blob");
}
if (name == null)
{
throw new ArgumentNullException("name");
}
if (version == null)
{
throw new ArgumentNullException("version");
}
if (name.Length == 0)
{
throw new ArgumentException(Locale.GetText("Empty"), "name");
}
this.publickey = blob;
this.name = name;
this.version = version;
}
// Token: 0x060034B1 RID: 13489 RVA: 0x000B5C74 File Offset: 0x000B3E74
int IBuiltInEvidence.GetRequiredSize(bool verbose)
{
return ((!verbose) ? 1 : 5) + this.name.Length;
}
// Token: 0x060034B2 RID: 13490 RVA: 0x000B5C90 File Offset: 0x000B3E90
[MonoTODO("IBuiltInEvidence")]
int IBuiltInEvidence.InitFromBuffer(char[] buffer, int position)
{
return 0;
}
// Token: 0x060034B3 RID: 13491 RVA: 0x000B5C94 File Offset: 0x000B3E94
[MonoTODO("IBuiltInEvidence")]
int IBuiltInEvidence.OutputToBuffer(char[] buffer, int position, bool verbose)
{
return 0;
}
/// Gets the simple name of the current .
/// The simple name part of the .
// Token: 0x17000A55 RID: 2645
// (get) Token: 0x060034B4 RID: 13492 RVA: 0x000B5C98 File Offset: 0x000B3E98
public string Name
{
get
{
return this.name;
}
}
/// Gets the of the current .
/// The of the current .
// Token: 0x17000A56 RID: 2646
// (get) Token: 0x060034B5 RID: 13493 RVA: 0x000B5CA0 File Offset: 0x000B3EA0
public StrongNamePublicKeyBlob PublicKey
{
get
{
return this.publickey;
}
}
/// Gets the of the current .
/// The of the current .
// Token: 0x17000A57 RID: 2647
// (get) Token: 0x060034B6 RID: 13494 RVA: 0x000B5CA8 File Offset: 0x000B3EA8
public Version Version
{
get
{
return this.version;
}
}
/// Creates an equivalent copy of the current .
/// A new, identical copy of the current .
// Token: 0x060034B7 RID: 13495 RVA: 0x000B5CB0 File Offset: 0x000B3EB0
public object Copy()
{
return new StrongName(this.publickey, this.name, this.version);
}
/// Creates a that corresponds to the current .
/// A for the specified .
/// The from which to construct the .
// Token: 0x060034B8 RID: 13496 RVA: 0x000B5CCC File Offset: 0x000B3ECC
public IPermission CreateIdentityPermission(Evidence evidence)
{
return new StrongNameIdentityPermission(this.publickey, this.name, this.version);
}
/// Determines whether the specified strong name is equal to the current strong name.
/// true if the specified strong name is equal to the current strong name; otherwise, false.
/// The strong name to compare against the current strong name.
// Token: 0x060034B9 RID: 13497 RVA: 0x000B5CE8 File Offset: 0x000B3EE8
public override bool Equals(object o)
{
StrongName strongName = o as StrongName;
return strongName != null && !(this.name != strongName.Name) && this.Version.Equals(strongName.Version) && this.PublicKey.Equals(strongName.PublicKey);
}
/// Gets the hash code of the current .
/// The hash code of the current .
// Token: 0x060034BA RID: 13498 RVA: 0x000B5D48 File Offset: 0x000B3F48
public override int GetHashCode()
{
return this.publickey.GetHashCode();
}
/// Creates a string representation of the current .
/// A representation of the current .
// Token: 0x060034BB RID: 13499 RVA: 0x000B5D58 File Offset: 0x000B3F58
public override string ToString()
{
SecurityElement securityElement = new SecurityElement(typeof(StrongName).Name);
securityElement.AddAttribute("version", "1");
securityElement.AddAttribute("Key", this.publickey.ToString());
securityElement.AddAttribute("Name", this.name);
securityElement.AddAttribute("Version", this.version.ToString());
return securityElement.ToString();
}
// Token: 0x04001576 RID: 5494
private StrongNamePublicKeyBlob publickey;
// Token: 0x04001577 RID: 5495
private string name;
// Token: 0x04001578 RID: 5496
private Version version;
}
}