Imported Upstream version 5.20.0.180

Former-commit-id: ff953ca879339fe1e1211f7220f563e1342e66cb
This commit is contained in:
Xamarin Public Jenkins (auto-signing)
2019-02-04 20:11:37 +00:00
parent 0e2d47d1c8
commit 0510252385
3360 changed files with 83827 additions and 39243 deletions

View File

@@ -1,40 +0,0 @@
//
// System.Security.Policy.ApplicationVersionMatch enumeration
//
// Author:
// Sebastien Pouliot <sebastien@ximian.com>
//
// Copyright (C) 2004-2005 Novell, Inc (http://www.novell.com)
//
// Permission is hereby granted, free of charge, to any person obtaining
// a copy of this software and associated documentation files (the
// "Software"), to deal in the Software without restriction, including
// without limitation the rights to use, copy, modify, merge, publish,
// distribute, sublicense, and/or sell copies of the Software, and to
// permit persons to whom the Software is furnished to do so, subject to
// the following conditions:
//
// The above copyright notice and this permission notice shall be
// included in all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
//
using System.Runtime.InteropServices;
namespace System.Security.Policy {
[ComVisible (true)]
public enum ApplicationVersionMatch {
MatchExactVersion,
MatchAllVersions
}
}

View File

@@ -37,8 +37,8 @@ using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using System.Security.Permissions;
using System.Security.Cryptography;
using System.Security.Cryptography.X509Certificates;
using Mono.Security.Authenticode;
namespace System.Security.Policy {
@@ -260,16 +260,14 @@ namespace System.Security.Policy {
// Authenticode(r) signed assemblies get a Publisher evidence
if (IsAuthenticodePresent (a)) {
// Note: The certificate is part of the evidences even if it is not trusted!
// so we can't call X509Certificate.CreateFromSignedFile
AuthenticodeDeformatter ad = new AuthenticodeDeformatter (a.Location);
if (ad.SigningCertificate != null) {
X509Certificate x509 = new X509Certificate (ad.SigningCertificate.RawData);
if (x509.GetHashCode () != 0) {
e.AddHost (new Publisher (x509));
}
try {
X509Certificate x509 = X509Certificate.CreateFromSignedFile (a.Location);
e.AddHost (new Publisher (x509));
}
catch (CryptographicException) {
}
}
// assemblies loaded from the GAC also get a Gac evidence (new in Fx 2.0)
if (a.GlobalAssemblyCache) {
e.AddHost (new GacInstalled ());

View File

@@ -1,38 +0,0 @@
//
// System.Security.Policy.IIdentityPermissionFactory
//
// Nick Drochak (ndrochak@gol.com)
//
// (C) 2001 Nick Drochak
// Copyright (C) 2004-2005 Novell, Inc (http://www.novell.com)
//
// Permission is hereby granted, free of charge, to any person obtaining
// a copy of this software and associated documentation files (the
// "Software"), to deal in the Software without restriction, including
// without limitation the rights to use, copy, modify, merge, publish,
// distribute, sublicense, and/or sell copies of the Software, and to
// permit persons to whom the Software is furnished to do so, subject to
// the following conditions:
//
// The above copyright notice and this permission notice shall be
// included in all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
//
using System.Runtime.InteropServices;
namespace System.Security.Policy {
[ComVisible (true)]
public interface IIdentityPermissionFactory {
IPermission CreateIdentityPermission(Evidence evidence);
}
}

View File

@@ -1,41 +0,0 @@
//
// System.Security.Policy.IMembershipCondition.cs
//
// Nick Drochak (ndrochak@gol.com)
//
// (C) 2001 Nick Drochak
// Copyright (C) 2004-2005 Novell, Inc (http://www.novell.com)
//
// Permission is hereby granted, free of charge, to any person obtaining
// a copy of this software and associated documentation files (the
// "Software"), to deal in the Software without restriction, including
// without limitation the rights to use, copy, modify, merge, publish,
// distribute, sublicense, and/or sell copies of the Software, and to
// permit persons to whom the Software is furnished to do so, subject to
// the following conditions:
//
// The above copyright notice and this permission notice shall be
// included in all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
//
using System.Runtime.InteropServices;
namespace System.Security.Policy {
[ComVisible (true)]
public interface IMembershipCondition : ISecurityEncodable, ISecurityPolicyEncodable {
bool Check (Evidence evidence);
IMembershipCondition Copy ();
bool Equals (object obj);
string ToString ();
}
}

View File

@@ -1,43 +0,0 @@
//
// System.Security.Policy.PolicyStatementAttribute
//
// Author:
// Nick Drochak (ndrochak@gol.com)
//
// (C) 2001 Nick Drochak
// Copyright (C) 2004-2005 Novell, Inc (http://www.novell.com)
//
// Permission is hereby granted, free of charge, to any person obtaining
// a copy of this software and associated documentation files (the
// "Software"), to deal in the Software without restriction, including
// without limitation the rights to use, copy, modify, merge, publish,
// distribute, sublicense, and/or sell copies of the Software, and to
// permit persons to whom the Software is furnished to do so, subject to
// the following conditions:
//
// The above copyright notice and this permission notice shall be
// included in all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
//
using System.Runtime.InteropServices;
namespace System.Security.Policy {
[Flags]
[Serializable]
[ComVisible (true)]
public enum PolicyStatementAttribute {
Nothing = 0,
Exclusive = 1,
LevelFinal = 2,
All = 3
}
}

View File

@@ -53,10 +53,10 @@ namespace System.Security.Policy {
throw new ArgumentException (Locale.GetText ("name is not valid"));
origin_site = name;
}
}
public static Site CreateFromUrl (string url)
{
public static Site CreateFromUrl (string url)
{
if (url == null)
throw new ArgumentNullException ("url");
if (url.Length == 0)
@@ -68,45 +68,45 @@ namespace System.Security.Policy {
throw new ArgumentException (msg, "url");
}
return new Site (site);
}
return new Site (site);
}
public object Copy ()
{
return new Site (origin_site);
}
public object Copy ()
{
return new Site (origin_site);
}
public IPermission CreateIdentityPermission (Evidence evidence)
{
return new SiteIdentityPermission (origin_site);
}
public IPermission CreateIdentityPermission (Evidence evidence)
{
return new SiteIdentityPermission (origin_site);
}
public override bool Equals (object o)
{
public override bool Equals (object o)
{
Site s = (o as System.Security.Policy.Site);
if (s == null)
return false;
return (String.Compare (s.Name, origin_site, true, CultureInfo.InvariantCulture) == 0);
}
}
public override int GetHashCode ()
{
return origin_site.GetHashCode ();
}
public override int GetHashCode ()
{
return origin_site.GetHashCode ();
}
public override string ToString ()
{
public override string ToString ()
{
SecurityElement element = new SecurityElement ("System.Security.Policy.Site");
element.AddAttribute ("version", "1");
element.AddChild (new SecurityElement ("Name", origin_site));
return element.ToString ();
}
}
// properties
public string Name {
get { return origin_site; }
}
public string Name {
get { return origin_site; }
}
// interface IBuiltInEvidence
@@ -129,8 +129,8 @@ namespace System.Security.Policy {
// internals
internal static bool IsValid (string name)
{
internal static bool IsValid (string name)
{
if (name == String.Empty)
return false;
if ((name.Length == 1) && (name == ".")) // split would remove .
@@ -154,8 +154,8 @@ namespace System.Security.Policy {
return false;
}
}
return true;
}
return true;
}
// no exception - we return null if a site couldn't be created
// this is useful for creating the default evidence as the majority of URL will be local (file://)
@@ -171,5 +171,5 @@ namespace System.Security.Policy {
string site = uri.Host;
return IsValid (site) ? site : null;
}
}
}
}