18 private bool m_appTrustedToRun;
20 private bool m_persist;
22 private object m_extraInfo;
31 private int m_grantSetSpecialFlags;
59 if (m_psDefaultGrant ==
null)
63 return m_psDefaultGrant;
69 m_psDefaultGrant =
null;
70 m_grantSetSpecialFlags = 0;
74 m_psDefaultGrant = value;
91 return m_appTrustedToRun;
95 m_appTrustedToRun = value;
120 if (m_elExtraInfo !=
null)
122 m_extraInfo = ObjectFromXml(m_elExtraInfo);
123 m_elExtraInfo =
null;
129 m_elExtraInfo =
null;
150 InitDefaultGrantSet(defaultGrantSet);
165 if (fullTrustAssemblies ==
null)
169 InitDefaultGrantSet(defaultGrantSet);
171 foreach (
StrongName fullTrustAssembly
in fullTrustAssemblies)
173 if (fullTrustAssembly ==
null)
179 m_fullTrustAssemblies = list.AsReadOnly();
182 private void InitDefaultGrantSet(
PermissionSet defaultGrantSet)
184 if (defaultGrantSet ==
null)
201 if (m_appTrustedToRun)
209 if (m_psDefaultGrant !=
null)
213 securityElement.
AddChild(securityElement2);
215 if (m_fullTrustAssemblies.
Count > 0)
218 foreach (
StrongName fullTrustAssembly
in m_fullTrustAssemblies)
220 securityElement3.AddChild(fullTrustAssembly.ToXml());
222 securityElement.
AddChild(securityElement3);
228 return securityElement;
246 m_appTrustedToRun =
false;
247 string text = element.Attribute(
"TrustedToRun");
248 if (text !=
null &&
string.Compare(text,
"true",
StringComparison.Ordinal) == 0)
250 m_appTrustedToRun =
true;
253 string text2 = element.Attribute(
"Persist");
254 if (text2 !=
null &&
string.Compare(text2,
"true",
StringComparison.Ordinal) == 0)
259 string text3 = element.Attribute(
"FullName");
260 if (text3 !=
null && text3.Length > 0)
264 m_psDefaultGrant =
null;
265 m_grantSetSpecialFlags = 0;
267 if (securityElement !=
null)
270 if (securityElement2 !=
null)
273 policyStatement.
FromXml(securityElement2);
274 m_psDefaultGrant = policyStatement;
280 if (securityElement3 !=
null && securityElement3.InternalChildren !=
null)
287 list.Add(strongName);
290 m_fullTrustAssemblies = list.AsReadOnly();
298 if (securityEncodable !=
null)
300 securityElement = securityEncodable.
ToXml();
301 if (!securityElement.
Tag.Equals(tag))
308 binaryFormatter.
Serialize(memoryStream, obj);
309 byte[] sArray = memoryStream.
ToArray();
310 securityElement =
new SecurityElement(tag);
311 securityElement.
AddAttribute(
"Data", Hex.EncodeHexString(sArray));
312 return securityElement;
315 private static object ObjectFromXml(SecurityElement elObject)
317 if (elObject.Attribute(
"class") !=
null)
319 ISecurityEncodable securityEncodable = XMLUtil.CreateCodeGroup(elObject) as ISecurityEncodable;
320 if (securityEncodable !=
null)
322 securityEncodable.
FromXml(elObject);
323 return securityEncodable;
326 string hexString = elObject.Attribute(
"Data");
329 return binaryFormatter.Deserialize(serializationStream);
334 [SecuritySafeCritical]
The exception that is thrown when a null reference (Nothing in Visual Basic) is passed to a method th...
void FromXml(SecurityElement element)
Reconstructs an T:System.Security.Policy.ApplicationTrust object with a given state from an XML encod...
Encapsulates security decisions about an application. This class cannot be inherited.
Describes a set of security permissions applied to code. This class cannot be inherited.
bool Persist
Gets or sets a value indicating whether application trust information is persisted.
IList< StrongName > FullTrustAssemblies
Gets the list of full-trust assemblies for this application trust.
bool MoveNext()
Advances the enumerator to the next element of the collection.
Provides the strong name of a code assembly as evidence for policy evaluation. This class cannot be i...
StringComparison
Specifies the culture, case, and sort rules to be used by certain overloads of the M:System....
PermissionSet PermissionSet
Gets or sets the T:System.Security.PermissionSet of the policy statement.
No initialization action.
Represents a non-generic collection of objects that can be individually accessed by index.
ReadOnlyCollection< T > AsReadOnly()
Returns a read-only T:System.Collections.ObjectModel.ReadOnlyCollection`1 wrapper for the current col...
StrongNamePublicKeyBlob PublicKey
Gets the T:System.Security.Permissions.StrongNamePublicKeyBlob of the current T:System....
SecurityElement SearchForChildByTag(string tag)
Finds a child by its tag name.
Version Version
Gets the T:System.Version of the current T:System.Security.Policy.StrongName.
ApplicationTrust(PermissionSet defaultGrantSet, IEnumerable< StrongName > fullTrustAssemblies)
Initializes a new instance of the T:System.Security.Policy.ApplicationTrust class using the provided ...
string Tag
Gets or sets the tag name of an XML element.
Provides a base class from which all objects to be used as evidence must derive.
void FromXml(SecurityElement e)
Reconstructs a security object with a specified state from an XML encoding.
Represents the statement of a T:System.Security.Policy.CodeGroup describing the permissions and other...
static string Escape(string str)
Replaces invalid XML characters in a string with their valid XML equivalent.
void AddChild(SecurityElement child)
Adds a child element to the XML element.
SecurityAction
Specifies the security actions that can be performed using declarative security.
Exposes an enumerator, which supports a simple iteration over a non-generic collection....
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...
Represents a collection that can contain many different types of permissions.
virtual byte [] ToArray()
Writes the stream contents to a byte array, regardless of the P:System.IO.MemoryStream....
Represents the XML object model for encoding security objects. This class cannot be inherited.
Defines the methods that convert permission object state to and from XML element representation.
object Current
Gets the element in the collection at the current position of the enumerator.
override EvidenceBase Clone()
Creates a new object that is a complete copy of the current instance.
SecurityElement ToXml()
Creates an XML encoding of the security object and its current state.
bool IsApplicationTrustedToRun
Gets or sets a value indicating whether the application has the required permission grants and is tru...
ApplicationIdentity ApplicationIdentity
Gets or sets the application identity for the application trust object.
SecurityElement ToXml()
Creates an XML encoding of the T:System.Security.Policy.ApplicationTrust object and its current state...
SecurityElement ToXml()
Creates an XML encoding of the security object and its current state.
The exception that is thrown when one of the arguments provided to a method is not valid.
ApplicationTrust(ApplicationIdentity applicationIdentity)
Initializes a new instance of the T:System.Security.Policy.ApplicationTrust class with an T:System....
Represents a strongly typed list of objects that can be accessed by index. Provides methods to search...
PermissionState
Specifies whether a permission should have all or no access to resources at creation.
void AddAttribute(string name, string value)
Adds a name/value attribute to an XML element.
ApplicationTrust()
Initializes a new instance of the T:System.Security.Policy.ApplicationTrust class.
Provides the ability to uniquely identify a manifest-activated application. This class cannot be inhe...
Specifies that the class can be serialized.
ArrayList Children
Gets or sets the array of child elements of the XML element.
void FromXml(SecurityElement et)
Reconstructs a security object with a given state from an XML encoding.
virtual IEnumerator GetEnumerator()
Returns an enumerator for the entire T:System.Collections.ArrayList.
Provides the main access point for classes interacting with the security system. This class cannot be...
int Count
Gets the number of elements contained in the T:System.Collections.ICollection.
object ExtraInfo
Gets or sets extra security information about the application.
Supports a simple iteration over a non-generic collection.
virtual EvidenceBase Clone()
Creates a new object that is a complete copy of the current instance.
string Name
Gets the simple name of the current T:System.Security.Policy.StrongName.
PolicyStatement DefaultGrantSet
Gets or sets the policy statement defining the default grant set.