using System;
using System.Runtime.InteropServices;
using System.Security.Cryptography.X509Certificates;
using System.Security.Permissions;
namespace System.Security.Policy
{
/// Provides the Authenticode X.509v3 digital signature of a code assembly as evidence for policy evaluation. This class cannot be inherited.
// Token: 0x0200059C RID: 1436
[ComVisible(true)]
[Serializable]
public sealed class Publisher : IBuiltInEvidence, IIdentityPermissionFactory
{
/// Initializes a new instance of the class with the Authenticode X.509v3 certificate containing the publisher's public key.
/// An that contains the software publisher's public key.
/// The parameter is null.
// Token: 0x0600347F RID: 13439 RVA: 0x000B5378 File Offset: 0x000B3578
public Publisher(X509Certificate cert)
{
if (cert == null)
{
throw new ArgumentNullException("cert");
}
if (cert.GetHashCode() == 0)
{
throw new ArgumentException("cert");
}
this.m_cert = cert;
}
// Token: 0x06003480 RID: 13440 RVA: 0x000B53BC File Offset: 0x000B35BC
int IBuiltInEvidence.GetRequiredSize(bool verbose)
{
return ((!verbose) ? 1 : 3) + this.m_cert.GetRawCertData().Length;
}
// Token: 0x06003481 RID: 13441 RVA: 0x000B53DC File Offset: 0x000B35DC
[MonoTODO("IBuiltInEvidence")]
int IBuiltInEvidence.InitFromBuffer(char[] buffer, int position)
{
return 0;
}
// Token: 0x06003482 RID: 13442 RVA: 0x000B53E0 File Offset: 0x000B35E0
[MonoTODO("IBuiltInEvidence")]
int IBuiltInEvidence.OutputToBuffer(char[] buffer, int position, bool verbose)
{
return 0;
}
/// Gets the publisher's Authenticode X.509v3 certificate.
/// The publisher's .
// Token: 0x17000A51 RID: 2641
// (get) Token: 0x06003483 RID: 13443 RVA: 0x000B53E4 File Offset: 0x000B35E4
public X509Certificate Certificate
{
get
{
if (this.m_cert.GetHashCode() == 0)
{
throw new ArgumentException("m_cert");
}
return this.m_cert;
}
}
/// Creates an equivalent copy of the .
/// A new, identical copy of the .
// Token: 0x06003484 RID: 13444 RVA: 0x000B5408 File Offset: 0x000B3608
public object Copy()
{
return new Publisher(this.m_cert);
}
/// Creates an identity permission that corresponds to the current instance of the class.
/// A for the specified .
/// The from which to construct the identity permission.
// Token: 0x06003485 RID: 13445 RVA: 0x000B5418 File Offset: 0x000B3618
public IPermission CreateIdentityPermission(Evidence evidence)
{
return new PublisherIdentityPermission(this.m_cert);
}
/// Compares the current to the specified object for equivalence.
/// true if the two instances of the class are equal; otherwise, false.
/// The to test for equivalence with the current object.
/// The parameter is not a object.
// Token: 0x06003486 RID: 13446 RVA: 0x000B5428 File Offset: 0x000B3628
public override bool Equals(object o)
{
Publisher publisher = o as Publisher;
if (publisher == null)
{
throw new ArgumentException("o", Locale.GetText("not a Publisher instance."));
}
return this.m_cert.Equals(publisher.Certificate);
}
/// Gets the hash code of the current .
/// The hash code of the current .
// Token: 0x06003487 RID: 13447 RVA: 0x000B5468 File Offset: 0x000B3668
public override int GetHashCode()
{
return this.m_cert.GetHashCode();
}
/// Returns a string representation of the current .
/// A representation of the current .
// Token: 0x06003488 RID: 13448 RVA: 0x000B5478 File Offset: 0x000B3678
public override string ToString()
{
SecurityElement securityElement = new SecurityElement("System.Security.Policy.Publisher");
securityElement.AddAttribute("version", "1");
SecurityElement securityElement2 = new SecurityElement("X509v3Certificate");
string rawCertDataString = this.m_cert.GetRawCertDataString();
if (rawCertDataString != null)
{
securityElement2.Text = rawCertDataString;
}
securityElement.AddChild(securityElement2);
return securityElement.ToString();
}
// Token: 0x04001570 RID: 5488
private X509Certificate m_cert;
}
}