Changeset 2526


Ignore:
Timestamp:
3/15/2012 12:51:46 AM (2 years ago)
Author:
lowjoel
Message:

StrongNameSignatureVerificationEx? has been deprecated. For .NET 4, we need to instantiate and ICLRStrongName from the current runtime and call the interface's StrongNameSignatureVerificationEx?. This code adds a dependency on a managed library by the CLR Runtime Activation Team (http://clractivation.codeplex.com), included in the distribution.

Location:
trunk/eraser
Files:
4 added
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/eraser/Eraser.Util/Eraser.Util.csproj

    r2514 r2526  
    5555  </PropertyGroup> 
    5656  <ItemGroup> 
    57     <Reference Include="alglib, Version=2.3.0.0, Culture=neutral, PublicKeyToken=3ac89a0351e689b6, processorArchitecture=MSIL"> 
    58       <SpecificVersion>False</SpecificVersion> 
    59       <HintPath>..\Dependencies\alglib.dll</HintPath> 
     57    <Reference Include="alglibnet2"> 
     58      <HintPath>..\Dependencies\alglibnet2.dll</HintPath> 
    6059    </Reference> 
    6160    <Reference Include="CommonLibrary, Version=0.9.3.10, Culture=neutral, PublicKeyToken=3ac89a0351e689b6, processorArchitecture=MSIL"> 
    6261      <SpecificVersion>False</SpecificVersion> 
    6362      <HintPath>..\Dependencies\CommonLibrary.dll</HintPath> 
     63    </Reference> 
     64    <Reference Include="Microsoft.Runtime.Hosting"> 
     65      <HintPath>..\Dependencies\Microsoft.Runtime.Hosting.dll</HintPath> 
     66    </Reference> 
     67    <Reference Include="Microsoft.Runtime.Hosting.Interop"> 
     68      <HintPath>..\Dependencies\Microsoft.Runtime.Hosting.Interop.dll</HintPath> 
     69      <EmbedInteropTypes>True</EmbedInteropTypes> 
    6470    </Reference> 
    6571    <Reference Include="System" /> 
     
    8591    <Compile Include="Localisation.cs" /> 
    8692    <Compile Include="NativeMethods\Kernel.cs" /> 
    87     <Compile Include="NativeMethods\MsCorEE.cs" /> 
    8893    <Compile Include="NativeMethods\NetApi.cs" /> 
    8994    <Compile Include="NativeMethods\NtDll.cs" /> 
  • trunk/eraser/Eraser.Util/Security.cs

    r2516 r2526  
    2323using System.Collections.Generic; 
    2424using System.Text; 
     25 
    2526using System.ComponentModel; 
    2627using System.Security.Principal; 
    2728using System.Runtime.InteropServices; 
     29 
    2830using Microsoft.Win32.SafeHandles; 
     31using Microsoft.Runtime.Hosting; 
     32using Microsoft.Runtime.Hosting.Interop; 
    2933 
    3034namespace Eraser.Util 
     
    8892        public static bool VerifyStrongName(string assemblyPath) 
    8993        { 
    90             bool wasVerified = false; 
    91             return NativeMethods.StrongNameSignatureVerificationEx(assemblyPath, false, 
    92                 out wasVerified) && wasVerified; 
     94            ICLRStrongName strongName = ClrMetaHost.CurrentRuntime.GetInterface<ICLRStrongName>( 
     95                new Guid(0xB79B0ACD, 0xF5CD, 0x409b, 0xB5, 0xA5, 0xA1, 0x62, 0x44, 0x61, 0x0B, 0x92)); 
     96            return strongName.StrongNameSignatureVerificationEx(assemblyPath, 1) != 0; 
    9397        } 
    9498    } 
Note: See TracChangeset for help on using the changeset viewer.