Exposing StrongNameKeyPair
authorRama Krishnan Raghupathy <ramarag@microsoft.com>
Fri, 7 Oct 2016 23:36:46 +0000 (16:36 -0700)
committerRama Krishnan Raghupathy <ramarag@microsoft.com>
Mon, 10 Oct 2016 19:35:01 +0000 (12:35 -0700)
src/mscorlib/model.xml
src/mscorlib/ref/mscorlib.cs
src/mscorlib/src/System/Reflection/StrongNameKeyPair.cs

index c363338a7bfce1684eea81f18faf614413a9ad1a..a27744c0c955bb135c999a4f73e3d3185dbf732c 100644 (file)
       <Member Name="get_Name" />
       <Member Name="get_ProcessorArchitecture" />
       <Member Name="get_Version" />
+      <Member Name="get_KeyPair" />
       <Member Name="GetAssemblyName(System.String)" />
       <Member Name="GetPublicKey" />
       <Member Name="GetPublicKeyToken" />
       <Member Name="set_Name(System.String)" />
       <Member Name="set_ProcessorArchitecture(System.Reflection.ProcessorArchitecture)" />
       <Member Name="set_Version(System.Version)" />
+      <Member Name="set_KeyPair(System.Reflection.StrongNameKeyPair)" />
       <Member Name="Clone" />
       <Member Name="SetPublicKey(System.Byte[])" />
       <Member Name="SetPublicKeyToken(System.Byte[])" />
       <Member MemberType="Property" Name="ProcessorArchitecture" />
       <Member MemberType="Property" Name="Version" />
       <Member MemberType="Property" Name="VersionCompatibility" />
+      <Member MemberType="Property" Name="KeyPair" />
     </Type>
     <Type Name="System.Reflection.AssemblyNameFlags">
       <Member MemberType="Field" Name="EnableJITcompileOptimizer" />
     <Type Name="System.Runtime.InteropServices.PreserveSigAttribute">
       <Member Name="#ctor" />
     </Type>
-    <Type Name="System.Runtime.InteropServices.RuntimeEnvironment">
-       <Member Name="GetRuntimeDirectory" /> <!-- For use in the Framework, but not public in Win8P reference assemblies. -->
-    </Type>
     <Type Name="System.Runtime.InteropServices.SafeHandle">
       <Member MemberType="Field" Name="handle" />
       <Member Name="#ctor(System.IntPtr,System.Boolean)" />
       <Member Status="ApiRoot" Name="EndInvoke(System.IAsyncResult)" />
       <Member Status="ApiRoot" Name="Invoke(System.Type,System.Object)" />
     </Type>
+    <Type Name="System.Reflection.StrongNameKeyPair">
+      <Member Name="#ctor(System.Byte[])" />
+      <!--      <Member Name="#ctor(System.IO.FileStream)" /> -->
+      <Member Name="#ctor(System.Runtime.Serialization.SerializationInfo,System.Runtime.Serialization.StreamingContext)" />
+      <Member Name="#ctor(System.String)" />
+      <Member Name="get_PublicKey" />
+      <Member MemberType="Property" Name="PublicKey" />
+      <Member Status="ImplRoot" Name="System.Runtime.Serialization.IDeserializationCallback.OnDeserialization(System.Object)" />
+      <Member Status="ImplRoot" Name="System.Runtime.Serialization.ISerializable.GetObjectData(System.Runtime.Serialization.SerializationInfo,System.Runtime.Serialization.StreamingContext)" />
+    </Type>
     <Type Status="ImplRoot" Name="System.ReflectionOnlyType" />
     <Type Status="ImplRoot" Name="System.ResId" />
     <Type Status="ImplRoot" Name="System.Resolver">
index 7b5fa7730a9fe3b5120723fa991a94172f4e9ddb..e46e8f96b4c4bbcc8c509c5c50a7cf513130dbdb 100644 (file)
@@ -7345,6 +7345,7 @@ namespace System.Reflection
         public System.Reflection.AssemblyNameFlags Flags { get { throw null; } set { } }
         public string FullName { [System.Security.SecuritySafeCriticalAttribute]get { throw null; } }
         public System.Configuration.Assemblies.AssemblyHashAlgorithm HashAlgorithm { get { throw null; } set { } }
+        public System.Reflection.StrongNameKeyPair KeyPair { get { throw null; } set { } }
         public System.Configuration.Assemblies.AssemblyVersionCompatibility VersionCompatibility { get { throw null; } set { } }
         public string Name { get { throw null; } set { } }
         public System.Reflection.ProcessorArchitecture ProcessorArchitecture { get { throw null; } set { } }
@@ -8383,6 +8384,16 @@ namespace System.Reflection
         public virtual bool IsAssignableFrom(System.Reflection.TypeInfo typeInfo) { throw null; }
         System.Reflection.TypeInfo System.Reflection.IReflectableType.GetTypeInfo() { throw null; }
     }
+    [System.Runtime.InteropServices.ComVisibleAttribute(true)]
+    public partial class StrongNameKeyPair : System.Runtime.Serialization.IDeserializationCallback, System.Runtime.Serialization.ISerializable 
+    {
+        public StrongNameKeyPair(byte[] keyPairArray) { }
+        protected StrongNameKeyPair(System.Runtime.Serialization.SerializationInfo info, System.Runtime.Serialization.StreamingContext context) { }
+    public StrongNameKeyPair(string keyPairContainer) { }
+    public byte[] PublicKey { [System.Security.SecuritySafeCriticalAttribute]get { return default(byte[]); } }
+        void System.Runtime.Serialization.IDeserializationCallback.OnDeserialization(object sender) { }
+        void System.Runtime.Serialization.ISerializable.GetObjectData(System.Runtime.Serialization.SerializationInfo info, System.Runtime.Serialization.StreamingContext context) { }
+    }
 }
 namespace System.Reflection.Emit
 {
@@ -10894,12 +10905,6 @@ namespace System.Runtime.InteropServices
         public PreserveSigAttribute() { }
     }
     [System.Runtime.InteropServices.ComVisibleAttribute(true)]
-    public static partial class RuntimeEnvironment
-    {
-        [System.Security.SecuritySafeCriticalAttribute]
-        public static string GetRuntimeDirectory() { throw null; }
-    }
-    [System.Runtime.InteropServices.ComVisibleAttribute(true)]
     public partial class SafeArrayRankMismatchException : System.SystemException
     {
         public SafeArrayRankMismatchException() { }
index e8a441ca8f473a85c680b5a962d531577a264271..0d69a654edd67580b998e43960332edfd9151f11 100644 (file)
@@ -30,16 +30,6 @@ namespace System.Reflection
     using Microsoft.Runtime.Hosting;
 #endif
 
-#if FEATURE_CORECLR
-    // Dummy type to avoid ifdefs in signature definitions
-    public class StrongNameKeyPair
-    {       
-        private StrongNameKeyPair()
-        {
-            throw new NotSupportedException();
-        }
-    }
-#else
     [Serializable]
     [System.Runtime.InteropServices.ComVisible(true)]
     public class StrongNameKeyPair : IDeserializationCallback, ISerializable 
@@ -49,6 +39,7 @@ namespace System.Reflection
         private String  _keyPairContainer;
         private byte[]  _publicKey;
 
+#if !FEATURE_CORECLR
         // Build key pair from file.
         [System.Security.SecuritySafeCritical]  // auto-generated
 #pragma warning disable 618
@@ -66,6 +57,7 @@ namespace System.Reflection
 
             _keyPairExported = true;
         }
+#endif// FEATURE_CORECLR
 
         // Build key pair from byte array in memory.
         [System.Security.SecuritySafeCritical]  // auto-generated
@@ -83,7 +75,19 @@ namespace System.Reflection
 
             _keyPairExported = true;
         }
+        
+        [System.Security.SecuritySafeCritical]  // auto-generated
+#pragma warning disable 618
+        [SecurityPermissionAttribute(SecurityAction.Demand, Flags=SecurityPermissionFlag.UnmanagedCode)]
+#pragma warning restore 618
+        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[]));
+        }
 
+#if! FEATURE_CORECLR
         // Reference key pair in named key container.
         [System.Security.SecuritySafeCritical]  // auto-generated
 #pragma warning disable 618
@@ -100,17 +104,6 @@ namespace System.Reflection
             _keyPairExported = false;
         }
 
-        [System.Security.SecuritySafeCritical]  // auto-generated
-#pragma warning disable 618
-        [SecurityPermissionAttribute(SecurityAction.Demand, Flags=SecurityPermissionFlag.UnmanagedCode)]
-#pragma warning restore 618
-        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[]));
-        }
-
         // Get the public portion of the key pair.
         public byte[] PublicKey
         {
@@ -170,6 +163,27 @@ namespace System.Reflection
             }
             return publicKey;
         }
+        // Internal routine used to retrieve key pair info from unmanaged code.
+        private bool GetKeyPair(out Object arrayOrContainer)
+        {
+            arrayOrContainer = _keyPairExported ? (Object)_keyPairArray : (Object)_keyPairContainer;
+            return _keyPairExported;
+        }
+#else
+        public StrongNameKeyPair(String keyPairContainer)
+        {
+            throw new PlatformNotSupportedException();
+        }
+        
+        public byte[] PublicKey
+        {
+            get
+            {
+                throw new PlatformNotSupportedException();
+            }
+        }
+
+#endif// FEATURE_CORECLR
 
         /// <internalonly/>
         [System.Security.SecurityCritical]
@@ -183,12 +197,5 @@ namespace System.Reflection
         /// <internalonly/>
         void IDeserializationCallback.OnDeserialization (Object sender) {}
 
-        // Internal routine used to retrieve key pair info from unmanaged code.
-        private bool GetKeyPair(out Object arrayOrContainer)
-        {
-            arrayOrContainer = _keyPairExported ? (Object)_keyPairArray : (Object)_keyPairContainer;
-            return _keyPairExported;
-        }
     }
-#endif // FEATURE_CORECLR
 }