16 private string m_name;
21 private RuntimeAssembly m_assembly;
24 private bool m_wasUsed;
32 public string Name => m_name;
38 bool IDelayEvaluatedEvidence.IsVerified
43 if (!(m_assembly !=
null))
47 return m_assembly.IsStrongNameVerified;
51 bool IDelayEvaluatedEvidence.WasUsed
70 : this(blob, name, version, null)
80 if (
string.IsNullOrEmpty(name))
90 throw new ArgumentNullException(
"version");
92 RuntimeAssembly runtimeAssembly = assembly as RuntimeAssembly;
93 if (assembly !=
null && runtimeAssembly ==
null)
95 throw new ArgumentException(Environment.GetResourceString(
"Argument_MustBeRuntimeAssembly"),
"assembly");
97 m_publicKeyBlob = blob;
100 m_assembly = runtimeAssembly;
103 void IDelayEvaluatedEvidence.MarkUsed()
108 internal static bool CompareNames(
string asmName,
string mcName)
110 if (mcName.Length > 0 && mcName[mcName.Length - 1] ==
'*' && mcName.Length - 1 <= asmName.Length)
112 return string.Compare(mcName, 0, asmName, 0, mcName.Length - 1,
StringComparison.OrdinalIgnoreCase) == 0;
114 return string.Compare(mcName, asmName,
StringComparison.OrdinalIgnoreCase) == 0;
129 return new StrongName(m_publicKeyBlob, m_name, m_version);
143 if (m_publicKeyBlob !=
null)
145 securityElement.
AddAttribute(
"Key", Hex.EncodeHexString(m_publicKeyBlob.PublicKey));
151 if (m_version !=
null)
155 return securityElement;
158 internal void FromXml(SecurityElement element)
162 throw new ArgumentNullException(
"element");
164 if (
string.Compare(element.Tag,
"StrongName",
StringComparison.Ordinal) != 0)
166 throw new ArgumentException(Environment.GetResourceString(
"Argument_InvalidXML"));
168 m_publicKeyBlob =
null;
170 string text = element.Attribute(
"Key");
175 m_name = element.Attribute(
"Name");
176 string text2 = element.Attribute(
"Version");
179 m_version =
new Version(text2);
197 if (strongName !=
null &&
object.
Equals(m_publicKeyBlob, strongName.m_publicKeyBlob) &&
object.Equals(m_name, strongName.m_name))
199 return object.
Equals(m_version, strongName.m_version);
208 if (m_publicKeyBlob !=
null)
210 return m_publicKeyBlob.GetHashCode();
212 if (m_name !=
null || m_version !=
null)
214 return ((m_name !=
null) ? m_name.GetHashCode() : 0) + ((!(m_version ==
null)) ? m_version.
GetHashCode() : 0);
219 internal object Normalize()
223 binaryWriter.
Write(m_publicKeyBlob.PublicKey);
225 binaryWriter.
Write(m_name);
override int GetHashCode()
Returns a hash code for the current T:System.Version object.
The exception that is thrown when a null reference (Nothing in Visual Basic) is passed to a method th...
object Copy()
Creates an equivalent copy of the current T:System.Security.Policy.StrongName.
override string ToString()
Creates a string representation of the current T:System.Security.Policy.StrongName.
Provides the strong name of a code assembly as evidence for policy evaluation. This class cannot be i...
override int GetHashCode()
Gets the hash code of the current T:System.Security.Policy.StrongName.
StringComparison
Specifies the culture, case, and sort rules to be used by certain overloads of the M:System....
StrongNamePublicKeyBlob PublicKey
Gets the T:System.Security.Permissions.StrongNamePublicKeyBlob of the current T:System....
Version Version
Gets the T:System.Version of the current T:System.Security.Policy.StrongName.
Provides a base class from which all objects to be used as evidence must derive.
Defines the method that creates a new identity permission.
override string ToString()
Converts the value of the current T:System.Version object to its equivalent T:System....
override bool Equals(object o)
Determines whether the specified strong name is equal to the current strong name.
Provides information about, and means to manipulate, the current environment and platform....
Creates a stream whose backing store is memory.To browse the .NET Framework source code for this type...
int Major
Gets the value of the major component of the version number for the current T:System....
Represents the XML object model for encoding security objects. This class cannot be inherited.
StrongName(StrongNamePublicKeyBlob blob, string name, Version version)
Initializes a new instance of the T:System.Security.Policy.StrongName class with the strong name publ...
Represents an assembly, which is a reusable, versionable, and self-describing building block of a com...
Represents the version number of an assembly, operating system, or the common language runtime....
virtual void Write(bool value)
Writes a one-byte Boolean value to the current stream, with 0 representing false and 1 representing t...
Defines methods implemented by permission types.
Defines the identity permission for strong names. This class cannot be inherited.
The exception that is thrown when one of the arguments provided to a method is not valid.
IPermission CreateIdentityPermission(Evidence evidence)
Creates a T:System.Security.Permissions.StrongNameIdentityPermission that corresponds to the current ...
Defines the set of information that constitutes input to security policy decisions....
override EvidenceBase Clone()
Creates a new object that is a copy of the current instance.
void AddAttribute(string name, string value)
Adds a name/value attribute to an XML element.
Specifies that the class can be serialized.
Writes primitive types in binary to a stream and supports writing strings in a specific encoding.
override long Position
Gets or sets the current position within the stream.
override string ToString()
Produces a string representation of an XML element and its constituent attributes,...
string Name
Gets the simple name of the current T:System.Security.Policy.StrongName.
Represents the public key information (called a blob) for a strong name. This class cannot be inherit...