Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/mono/corert.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJan Kotas <jkotas@microsoft.com>2017-01-18 22:52:58 +0300
committerGitHub <noreply@github.com>2017-01-18 22:52:58 +0300
commit9158af3dd51243cc7ee457b7deed6dbe2afe0019 (patch)
tree4feb0a2d1279ca65b0e21bf613166cc6aa0f6a9a
parent029fc5a4ea9df5622d0a3c71313d82a13c86fe7f (diff)
parentd36cff726565d312e3c48381a15a54f7b54d02e8 (diff)
Merge pull request #2536 from dotnet-bot/from-tfs
Merge changes from TFS
-rw-r--r--src/System.Private.CoreLib/src/System.Private.CoreLib.csproj1
-rw-r--r--src/System.Private.CoreLib/src/System/Reflection/Assembly.cs32
-rw-r--r--src/System.Private.CoreLib/src/System/Reflection/AssemblyName.cs14
-rw-r--r--src/System.Private.CoreLib/src/System/Reflection/StrongNameKeyPair.cs73
-rw-r--r--src/System.Private.CoreLib/src/System/Security/Attributes.cs7
5 files changed, 127 insertions, 0 deletions
diff --git a/src/System.Private.CoreLib/src/System.Private.CoreLib.csproj b/src/System.Private.CoreLib/src/System.Private.CoreLib.csproj
index baf7c70b5..4998a45c6 100644
--- a/src/System.Private.CoreLib/src/System.Private.CoreLib.csproj
+++ b/src/System.Private.CoreLib/src/System.Private.CoreLib.csproj
@@ -194,6 +194,7 @@
<Compile Include="System\Reflection\ReflectionContext.cs" />
<Compile Include="System\Reflection\ReflectionTypeLoadException.cs" />
<Compile Include="System\Reflection\ResourceLocation.cs" />
+ <Compile Include="System\Reflection\StrongNameKeyPair.cs" />
<Compile Include="System\Reflection\TargetException.cs" />
<Compile Include="System\Reflection\TypeAttributes.cs" />
<Compile Include="System\Reflection\TypeFilter.cs" />
diff --git a/src/System.Private.CoreLib/src/System/Reflection/Assembly.cs b/src/System.Private.CoreLib/src/System/Reflection/Assembly.cs
index 2405a050f..84ff35d6b 100644
--- a/src/System.Private.CoreLib/src/System/Reflection/Assembly.cs
+++ b/src/System.Private.CoreLib/src/System/Reflection/Assembly.cs
@@ -5,7 +5,9 @@
using System.IO;
using System.Globalization;
using System.Collections.Generic;
+using System.Configuration.Assemblies;
using System.Runtime.Serialization;
+using System.Security;
using Internal.Reflection.Augments;
@@ -76,6 +78,8 @@ namespace System.Reflection
public virtual Stream GetManifestResourceStream(string name) { throw NotImplemented.ByDesign; }
public virtual Stream GetManifestResourceStream(Type type, string name) { throw NotImplemented.ByDesign; }
+ public bool IsFullyTrusted => true;
+
public virtual AssemblyName GetName() => GetName(copiedName: false);
public virtual AssemblyName GetName(bool copiedName) { throw NotImplemented.ByDesign; }
@@ -91,6 +95,8 @@ namespace System.Reflection
public virtual object[] GetCustomAttributes(bool inherit) { throw NotImplemented.ByDesign; }
public virtual object[] GetCustomAttributes(Type attributeType, bool inherit) { throw NotImplemented.ByDesign; }
+ public virtual String EscapedCodeBase => AssemblyName.EscapeCodeBase(CodeBase);
+
public object CreateInstance(string typeName) => CreateInstance(typeName, false, BindingFlags.Public | BindingFlags.Instance, binder: null, args: null, culture: null, activationAttributes: null);
public object CreateInstance(string typeName, bool ignoreCase) => CreateInstance(typeName, ignoreCase, BindingFlags.Public | BindingFlags.Instance, binder: null, args: null, culture: null, activationAttributes: null);
public virtual object CreateInstance(string typeName, bool ignoreCase, BindingFlags bindingAttr, Binder binder, object[] args, CultureInfo culture, object[] activationAttributes)
@@ -130,6 +136,12 @@ namespace System.Reflection
return displayName;
}
+ /*
+ Returns true if the assembly was loaded from the global assembly cache.
+ */
+ public virtual bool GlobalAssemblyCache { get { throw NotImplemented.ByDesign; } }
+ public virtual Int64 HostContext { get { throw NotImplemented.ByDesign; } }
+
public override bool Equals(object o) => base.Equals(o);
public override int GetHashCode() => base.GetHashCode();
@@ -180,8 +192,28 @@ namespace System.Reflection
return Load(name);
}
+ public static Assembly LoadFile(String path) { throw new PlatformNotSupportedException(); }
+ public static Assembly LoadFrom(String assemblyFile) { throw new PlatformNotSupportedException(); }
+ public static Assembly LoadFrom(String assemblyFile, byte[] hashValue, AssemblyHashAlgorithm hashAlgorithm) { throw new PlatformNotSupportedException(); }
+
+ [Obsolete("This method has been deprecated. Please use Assembly.Load() instead. http://go.microsoft.com/fwlink/?linkid=14202")]
+ public static Assembly LoadWithPartialName(String partialName)
+ {
+ if (partialName == null)
+ throw new ArgumentNullException(nameof(partialName));
+
+ return Load(partialName);
+ }
+
+ public static Assembly UnsafeLoadFrom(string assemblyFile) => LoadFrom(assemblyFile);
+
+ public Module LoadModule(String moduleName, byte[] rawModule) => LoadModule(moduleName, rawModule, null);
+ public virtual Module LoadModule(String moduleName, byte[] rawModule, byte[] rawSymbolStore) { throw NotImplemented.ByDesign; }
+
public static Assembly ReflectionOnlyLoad(byte[] rawAssembly) { throw new PlatformNotSupportedException(SR.PlatformNotSupported_ReflectionOnly); }
public static Assembly ReflectionOnlyLoad(string assemblyString) { throw new PlatformNotSupportedException(SR.PlatformNotSupported_ReflectionOnly); }
public static Assembly ReflectionOnlyLoadFrom(string assemblyFile) { throw new PlatformNotSupportedException(SR.PlatformNotSupported_ReflectionOnly); }
+
+ public virtual SecurityRuleSet SecurityRuleSet => SecurityRuleSet.None;
}
}
diff --git a/src/System.Private.CoreLib/src/System/Reflection/AssemblyName.cs b/src/System.Private.CoreLib/src/System/Reflection/AssemblyName.cs
index 0eed90c2a..d4b8cebef 100644
--- a/src/System.Private.CoreLib/src/System/Reflection/AssemblyName.cs
+++ b/src/System.Private.CoreLib/src/System/Reflection/AssemblyName.cs
@@ -129,6 +129,18 @@ namespace System.Reflection
public string CodeBase { get; set; }
public AssemblyHashAlgorithm HashAlgorithm { get; set; }
public AssemblyVersionCompatibility VersionCompatibility { get; set; }
+ public StrongNameKeyPair KeyPair { get; set; }
+
+ public String EscapedCodeBase
+ {
+ get
+ {
+ if (CodeBase == null)
+ return null;
+ else
+ return EscapeCodeBase(CodeBase);
+ }
+ }
public byte[] GetPublicKey()
{
@@ -172,6 +184,8 @@ namespace System.Reflection
public static AssemblyName GetAssemblyName(String assemblyFile) { throw new NotImplementedException(); }
public static bool ReferenceMatchesDefinition(AssemblyName reference, AssemblyName definition) { throw new NotImplementedException(); }
+ internal static String EscapeCodeBase(String codebase) { throw new PlatformNotSupportedException(); }
+
private AssemblyNameFlags _flags;
private byte[] _publicKey;
private byte[] _publicKeyToken;
diff --git a/src/System.Private.CoreLib/src/System/Reflection/StrongNameKeyPair.cs b/src/System.Private.CoreLib/src/System/Reflection/StrongNameKeyPair.cs
new file mode 100644
index 000000000..db3e92423
--- /dev/null
+++ b/src/System.Private.CoreLib/src/System/Reflection/StrongNameKeyPair.cs
@@ -0,0 +1,73 @@
+// Licensed to the .NET Foundation under one or more agreements.
+// The .NET Foundation licenses this file to you under the MIT license.
+// See the LICENSE file in the project root for more information.
+
+/*============================================================
+**
+**
+**
+**
+**
+** Purpose: Encapsulate access to a public/private key pair
+** used to sign strong name assemblies.
+**
+**
+===========================================================*/
+
+using System;
+using System.Runtime.Serialization;
+
+namespace System.Reflection
+{
+ [Serializable]
+ public class StrongNameKeyPair : IDeserializationCallback, ISerializable
+ {
+ private bool _keyPairExported;
+ private byte[] _keyPairArray;
+ private String _keyPairContainer;
+ private byte[] _publicKey;
+
+ // Build key pair from byte array in memory.
+ public StrongNameKeyPair(byte[] keyPairArray)
+ {
+ if (keyPairArray == null)
+ throw new ArgumentNullException(nameof(keyPairArray));
+
+ _keyPairArray = new byte[keyPairArray.Length];
+ Array.Copy(keyPairArray, _keyPairArray, keyPairArray.Length);
+
+ _keyPairExported = true;
+ }
+
+ protected StrongNameKeyPair(SerializationInfo info, StreamingContext context)
+ {
+ _keyPairExported = (bool)info.GetValue("_keyPairExported", typeof(bool));
+ _keyPairArray = (byte[])info.GetValue("_keyPairArray", typeof(byte[]));
+ _keyPairContainer = (string)info.GetValue("_keyPairContainer", typeof(string));
+ _publicKey = (byte[])info.GetValue("_publicKey", typeof(byte[]));
+ }
+
+ public StrongNameKeyPair(String keyPairContainer)
+ {
+ throw new PlatformNotSupportedException();
+ }
+
+ public byte[] PublicKey
+ {
+ get
+ {
+ throw new PlatformNotSupportedException();
+ }
+ }
+
+ void ISerializable.GetObjectData(SerializationInfo info, StreamingContext context)
+ {
+ info.AddValue("_keyPairExported", _keyPairExported);
+ info.AddValue("_keyPairArray", _keyPairArray);
+ info.AddValue("_keyPairContainer", _keyPairContainer);
+ info.AddValue("_publicKey", _publicKey);
+ }
+
+ void IDeserializationCallback.OnDeserialization(Object sender) { }
+ }
+}
diff --git a/src/System.Private.CoreLib/src/System/Security/Attributes.cs b/src/System.Private.CoreLib/src/System/Security/Attributes.cs
index 538fbf15d..fcb292cd2 100644
--- a/src/System.Private.CoreLib/src/System/Security/Attributes.cs
+++ b/src/System.Private.CoreLib/src/System/Security/Attributes.cs
@@ -71,4 +71,11 @@ namespace System.Security
{
public SecurityTransparentAttribute() { }
}
+
+ public enum SecurityRuleSet : byte
+ {
+ None = 0,
+ Level1 = 1, // v2.0 transparency model
+ Level2 = 2, // v4.0 transparency model
+ }
}