[btls] Remove btls-cert-sync and integrate it into cert-sync
authorAlexander Köplinger <alex.koeplinger@outlook.com>
Fri, 13 Jan 2017 13:42:50 +0000 (14:42 +0100)
committerAlexander Köplinger <alex.koeplinger@outlook.com>
Fri, 13 Jan 2017 13:43:04 +0000 (14:43 +0100)
cert-sync already knew how to import into the BTLS cert store,
update it to always import into both stores so we don't need
the btls-cert-sync tool anymore.

12 files changed:
mcs/class/System/Assembly/AssemblyInfo.cs
mcs/tools/Makefile
mcs/tools/btls/AssemblyInfo.cs [deleted file]
mcs/tools/btls/Makefile [deleted file]
mcs/tools/btls/btls-cert-sync-net_4_x.csproj [deleted file]
mcs/tools/btls/btls-cert-sync.cs [deleted file]
mcs/tools/btls/btls-cert-sync.exe.sources [deleted file]
mcs/tools/security/cert-sync.cs
msvc/scripts/order.xml
net_4_x.sln
scripts/.gitignore
scripts/Makefile.am

index b3c55010f6503268b8061c3576789a3828275a32..9b7145c1130efa2ee6d22b758ea34f2122b80ef0 100644 (file)
@@ -69,7 +69,6 @@ using System.Runtime.InteropServices;
 [assembly: InternalsVisibleTo ("System.ComponentModel.DataAnnotations, PublicKey=0024000004800000940000000602000000240000525341310004000001000100b5fc90e7027f67871e773a8fde8938c81dd402ba65b9201d60593e96c492651e889cc13f1415ebb53fac1131ae0bd333c5ee6021672d9718ea31a8aebd0da0072f25d87dba6fc90ffd598ed4da35e44c398c454307e8e33b8426143daec9f596836f97c8f74750e5975c64e2189f45def46b2a2b1247adc3652bf5c308055da9")]
 [assembly: InternalsVisibleTo ("System.Net.Http, PublicKey=002400000480000094000000060200000024000052534131000400000100010007d1fa57c4aed9f0a32e84aa0faefd0de9e8fd6aec8f87fb03766c834c99921eb23be79ad9d5dcc1dd9ad236132102900b723cf980957fc4e177108fc607774f29e8320e92ea05ece4e821c0a5efe8f1645c4c0c93c1ab99285d622caa652c1dfad63d745d6f2de5f17e5eaf0fc4963d261c8a12436518206dc093344d5ad293")]
 
-[assembly: InternalsVisibleTo ("btls-cert-sync, PublicKey=002400000480000094000000060200000024000052534131000400000100010079159977d2d03a8e6bea7a2e74e8d1afcc93e8851974952bb480a12c9134474d04062447c37e0e68c080536fcf3c3fbe2ff9c979ce998475e506e8ce82dd5b0f350dc10e93bf2eeecf874b24770c5081dbea7447fddafa277b22de47d6ffea449674a4f9fccf84d15069089380284dbdd35f46cdff12a1bd78e4ef0065d016df")]
 [assembly: InternalsVisibleTo ("Mono.Btls.Interface, PublicKey=002400000480000094000000060200000024000052534131000400000100010079159977d2d03a8e6bea7a2e74e8d1afcc93e8851974952bb480a12c9134474d04062447c37e0e68c080536fcf3c3fbe2ff9c979ce998475e506e8ce82dd5b0f350dc10e93bf2eeecf874b24770c5081dbea7447fddafa277b22de47d6ffea449674a4f9fccf84d15069089380284dbdd35f46cdff12a1bd78e4ef0065d016df")]
 [assembly: InternalsVisibleTo ("Mono.Security, PublicKey=002400000480000094000000060200000024000052534131000400000100010079159977d2d03a8e6bea7a2e74e8d1afcc93e8851974952bb480a12c9134474d04062447c37e0e68c080536fcf3c3fbe2ff9c979ce998475e506e8ce82dd5b0f350dc10e93bf2eeecf874b24770c5081dbea7447fddafa277b22de47d6ffea449674a4f9fccf84d15069089380284dbdd35f46cdff12a1bd78e4ef0065d016df")]
 
index 60600a30a325741f01915bcfef2b9706338f0267..a5d69ff81e5ed291b8d36617f751c8f31485dde0 100644 (file)
@@ -46,8 +46,7 @@ net_4_5_dirs := \
        mdbrebase       \
        ikdasm          \
        mono-symbolicate        \
-       linker-analyzer \
-       btls
+       linker-analyzer
 
 build_SUBDIRS = gacutil security culevel cil-stringreplacer commoncryptogenerator
 net_4_5_SUBDIRS = gacutil
diff --git a/mcs/tools/btls/AssemblyInfo.cs b/mcs/tools/btls/AssemblyInfo.cs
deleted file mode 100644 (file)
index 06f8d61..0000000
+++ /dev/null
@@ -1,26 +0,0 @@
-using System;
-using System.Diagnostics;
-using System.Reflection;
-using System.Resources;
-using System.Runtime.CompilerServices;
-using System.Runtime.InteropServices;
-
-[assembly: AssemblyTitle ("btls-cert-sync")]
-[assembly: AssemblyDescription ("btls-cert-sync")]
-[assembly: AssemblyDefaultAlias ("btls-cert-sync")]
-
-[assembly: AssemblyCompany (Consts.MonoCompany)]
-[assembly: AssemblyProduct (Consts.MonoProduct)]
-[assembly: AssemblyCopyright (Consts.MonoCopyright)]
-[assembly: AssemblyVersion (Consts.FxVersion)]
-[assembly: AssemblyFileVersion (Consts.FxFileVersion)]
-[assembly: SatelliteContractVersion (Consts.FxVersion)]
-[assembly: AssemblyInformationalVersion (Consts.FxFileVersion)]
-
-[assembly: CLSCompliant (true)]
-[assembly: NeutralResourcesLanguage ("en-US")]
-
-[assembly: ComVisible (false)]
-
-[assembly: AssemblyDelaySign (true)]
-[assembly: AssemblyKeyFile ("../../class/mono.pub")]
diff --git a/mcs/tools/btls/Makefile b/mcs/tools/btls/Makefile
deleted file mode 100644 (file)
index b551fa7..0000000
+++ /dev/null
@@ -1,17 +0,0 @@
-thisdir = tools/btls
-SUBDIRS = 
-include ../../build/rules.make
-
-LOCAL_MCS_FLAGS =
-LIB_REFS = System Mono.Security Mono.Btls.Interface
-PROGRAM = btls-cert-sync.exe
-
-ifndef HAVE_BTLS
-PROGRAM_NAME = dummy-btls-cert-sync.exe
-NO_INSTALL = yes
-NO_SIGN_ASSEMBLY = yes
-NO_TEST = yes
-NO_BUILD = yes
-endif
-
-include ../../build/executable.make
diff --git a/mcs/tools/btls/btls-cert-sync-net_4_x.csproj b/mcs/tools/btls/btls-cert-sync-net_4_x.csproj
deleted file mode 100644 (file)
index 5b49c7c..0000000
+++ /dev/null
@@ -1,99 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>\r
-<!-- WARNING: this file is autogenerated, don't modify it. Edit the .sources file of the corresponding assembly instead if you want to add/remove C# source files. -->\r
-<Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">\r
-  <PropertyGroup>\r
-    <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>\r
-    <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>\r
-    <ProductVersion>9.0.30729</ProductVersion>\r
-    <SchemaVersion>2.0</SchemaVersion>\r
-    <ProjectGuid>{2323EB4F-0DBA-47C7-B4AA-AD38CCD16BF8}</ProjectGuid>\r
-    <OutputType>Exe</OutputType>\r
-    <NoWarn>1699</NoWarn>\r
-    <OutputPath>./../../class/lib/net_4_x</OutputPath>\r
-    <IntermediateOutputPath>obj-net_4_x</IntermediateOutputPath>\r
-    <GenerateTargetFrameworkAttribute>false</GenerateTargetFrameworkAttribute>\r
-    <NoStdLib>True</NoStdLib>\r
-    \r
-    <NoConfig>True</NoConfig>\r
-    \r
-    <AppDesignerFolder>Properties</AppDesignerFolder>\r
-    <RootNamespace>\r
-    </RootNamespace>\r
-    <AssemblyName>btls-cert-sync</AssemblyName>\r
-    <TargetFrameworkVersion>v4.5</TargetFrameworkVersion>\r
-    <FileAlignment>512</FileAlignment>\r
-  </PropertyGroup>\r
-  \r
-  <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">\r
-    <DebugSymbols>true</DebugSymbols>\r
-    <DebugType>full</DebugType>\r
-    <NoWarn>1699</NoWarn>\r
-    <Optimize>false</Optimize>\r
-    <DefineConstants>TRACE;NET_4_0;NET_4_5;NET_4_6;MONO;WIN_PLATFORM</DefineConstants>\r
-    <ErrorReport>prompt</ErrorReport>\r
-    <WarningLevel>4</WarningLevel>\r
-  </PropertyGroup>\r
-  <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">\r
-    <DebugType>pdbonly</DebugType>\r
-    <NoWarn>1699</NoWarn>\r
-    <Optimize>true</Optimize>\r
-    <DefineConstants>NET_4_0;NET_4_5;NET_4_6;MONO;WIN_PLATFORM</DefineConstants>\r
-    <ErrorReport>prompt</ErrorReport>\r
-    <WarningLevel>4</WarningLevel>\r
-  </PropertyGroup>\r
-  <!-- Set AddAdditionalExplicitAssemblyReferences to false, otherwise if targetting .NET4.0, \r
-  Microsoft.NETFramework.props will force a dependency on the assembly System.Core. This\r
-  is a problem to compile the Mono mscorlib.dll -->\r
-  <PropertyGroup>\r
-    <AddAdditionalExplicitAssemblyReferences>false</AddAdditionalExplicitAssemblyReferences>\r
-  </PropertyGroup>\r
-  <Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />\r
-  <ItemGroup>\r
-    <Compile Include="..\..\build\common\Consts.cs" />\r
-    <Compile Include="..\..\build\common\SR.cs" />\r
-    <Compile Include="AssemblyInfo.cs" />\r
-    <Compile Include="btls-cert-sync.cs" />\r  </ItemGroup>\r
-  <!-- To modify your build process, add your task inside one of the targets below and uncomment it. \r
-       Other similar extension points exist, see Microsoft.Common.targets.\r
-  <Target Name="BeforeBuild">\r
-  </Target>\r
-  <Target Name="AfterBuild">\r
-  </Target>\r
-  -->\r
-  <PropertyGroup>\r
-    <PreBuildEvent Condition=" '$(OS)' != 'Windows_NT' ">
-
-    </PreBuildEvent>\r
-    <PreBuildEvent Condition=" '$(OS)' == 'Windows_NT' ">\r
-\r
-    </PreBuildEvent>\r
-    <PostBuildEvent Condition=" '$(OS)' != 'Windows_NT' ">
-
-    </PostBuildEvent>\r
-    <PostBuildEvent Condition=" '$(OS)' == 'Windows_NT' ">\r
-\r
-    </PostBuildEvent>\r
-  </PropertyGroup>\r
-  <ItemGroup>\r
-    <ProjectReference Include="../../class/corlib/corlib-net_4_x.csproj">\r
-      <Project>{2CA6026B-2DC8-4C4C-A12C-1E8234049DB7}</Project>\r
-      <Name>corlib-net_4_x</Name>\r
-    </ProjectReference>\r
-    <ProjectReference Include="../../class/System/System-net_4_x.csproj">\r
-      <Project>{2762E921-91A8-4C87-91E9-BA628013F753}</Project>\r
-      <Name>System-net_4_x</Name>\r
-    </ProjectReference>\r
-    <ProjectReference Include="../../class/Mono.Security/Mono.Security-net_4_x.csproj">\r
-      <Project>{42D59DE7-586F-4ACF-BDD5-E7869E39E3EF}</Project>\r
-      <Name>Mono.Security-net_4_x</Name>\r
-    </ProjectReference>\r
-    <ProjectReference Include="../../class/Mono.Btls.Interface/Mono.Btls.Interface-net_4_x.csproj">\r
-      <Project>{BF32D586-8FBB-4A2A-A734-AA17CDAB283F}</Project>\r
-      <Name>Mono.Btls.Interface-net_4_x</Name>\r
-    </ProjectReference>\r
-  </ItemGroup>\r
-  <ItemGroup>\r
-    <Folder Include="Properties\" />\r
-  </ItemGroup>\r
-</Project>\r
-
diff --git a/mcs/tools/btls/btls-cert-sync.cs b/mcs/tools/btls/btls-cert-sync.cs
deleted file mode 100644 (file)
index fcdc708..0000000
+++ /dev/null
@@ -1,61 +0,0 @@
-using System;
-using System.IO;
-using System.Text;
-using System.Security.Cryptography.X509Certificates;
-using MNS = Mono.Net.Security;
-
-namespace Mono.Btls
-{
-       static class BtlsCertSync
-       {
-               static void Main (string[] args)
-               {
-                       if (!MNS.MonoTlsProviderFactory.IsBtlsSupported ()) {
-                               Console.Error.WriteLine ("BTLS is not supported in this runtime!");
-                               Environment.Exit (255);
-                       }
-
-                       var configPath = Environment.GetFolderPath (Environment.SpecialFolder.ApplicationData);
-                       configPath = Path.Combine (configPath, ".mono");
-
-                       var oldStorePath = Path.Combine (configPath, "certs", "Trust");
-                       var newStorePath = MonoBtlsX509StoreManager.GetStorePath (MonoBtlsX509StoreType.UserTrustedRoots);
-
-                       if (!Directory.Exists (oldStorePath)) {
-                               Console.WriteLine ("Old trust store {0} does not exist.");
-                               Environment.Exit (255);
-                       }
-
-                       if (Directory.Exists (newStorePath))
-                               Directory.Delete (newStorePath, true);
-                       Directory.CreateDirectory (newStorePath);
-
-                       var oldfiles = Directory.GetFiles (oldStorePath, "*.cer");
-                       Console.WriteLine ("Found {0} files in the old store.", oldfiles.Length);
-
-                       foreach (var file in oldfiles) {
-                               Console.WriteLine ("Converting {0}.", file);
-                               var data = File.ReadAllBytes (file);
-                               using (var x509 = MonoBtlsX509.LoadFromData (data, MonoBtlsX509Format.DER)) {
-                                       ConvertToNewFormat (newStorePath, x509);
-                               }
-                       }
-               }
-
-               static void ConvertToNewFormat (string root, MonoBtlsX509 x509)
-               {
-                       long hash = x509.GetSubjectNameHash ();
-
-                       string newName;
-                       int index = 0;
-                       do {
-                               newName = Path.Combine (root, string.Format ("{0:x8}.{1}", hash, index++));
-                       } while (File.Exists (newName));
-                       Console.WriteLine ("  new name: {0}", newName);
-
-                       using (var stream = new FileStream (newName, FileMode.Create))
-                       using (var bio = MonoBtlsBio.CreateMonoStream (stream))
-                                x509.ExportAsPEM (bio, true);
-               }
-       }
-}
diff --git a/mcs/tools/btls/btls-cert-sync.exe.sources b/mcs/tools/btls/btls-cert-sync.exe.sources
deleted file mode 100644 (file)
index 706d78f..0000000
+++ /dev/null
@@ -1,4 +0,0 @@
-../../build/common/SR.cs
-../../build/common/Consts.cs
-AssemblyInfo.cs
-btls-cert-sync.cs
index 56797562e50592fbcf07f610d2bc5b2eed162755..b7b77f8f7660c78044a0fce67e6a2255a356946e 100644 (file)
@@ -1,5 +1,5 @@
 //
-// cert-sync.cs: Import the root certificates from Linux SSL store into Mono
+// cert-sync.cs: Import the root certificates from a certificate store into Mono
 //
 // Authors:
 //     Sebastien Pouliot <sebastien@ximian.com>
@@ -38,8 +38,8 @@ using System.Text;
 
 using Mono.Security.X509;
 
-[assembly: AssemblyTitle ("Linux Cert Store Sync")]
-[assembly: AssemblyDescription ("Synchronize local certs with certs from local Linux trust store.")]
+[assembly: AssemblyTitle ("Mono Certificate Store Sync")]
+[assembly: AssemblyDescription ("Populate Mono certificate store from a concatenated list of certificates.")]
 
 namespace Mono.Tools
 {
@@ -50,7 +50,6 @@ namespace Mono.Tools
                static string inputFile;
                static bool quiet;
                static bool userStore;
-               static bool btlsStore = false;
 
                static X509Certificate DecodeCertificate (string s)
                {
@@ -116,13 +115,26 @@ namespace Mono.Tools
                                WriteLine ("No certificates were found.");
                                return 0;
                        }
-                               
-                       X509Stores stores;
-                       if (userStore)
-                               stores = btlsStore ? X509StoreManager.NewCurrentUser : X509StoreManager.CurrentUser;
-                       else
-                               stores = btlsStore ? X509StoreManager.NewLocalMachine : X509StoreManager.LocalMachine;
-                       X509Store store = stores.TrustedRoot;
+
+                       if (userStore) {
+                               WriteLine ("Importing into legacy user store:");
+                               ImportToStore (roots, X509StoreManager.CurrentUser.TrustedRoot);
+                               WriteLine ("");
+                               WriteLine ("Importing into BTLS user store:");
+                               ImportToStore (roots, X509StoreManager.NewCurrentUser.TrustedRoot);
+                       } else {
+                               WriteLine ("Importing into legacy system store:");
+                               ImportToStore (roots, X509StoreManager.LocalMachine.TrustedRoot);
+                               WriteLine ("");
+                               WriteLine ("Importing into BTLS system store:");
+                               ImportToStore (roots, X509StoreManager.NewLocalMachine.TrustedRoot);
+                       }
+
+                       return 0;
+               }
+
+               static void ImportToStore (X509CertificateCollection roots, X509Store store)
+               {
                        X509CertificateCollection trusted = store.Certificates;
                        int additions = 0;
                        WriteLine ("I already trust {0}, your new list has {1}", trusted.Count, roots.Count);
@@ -156,7 +168,6 @@ namespace Mono.Tools
                                }
                        }
                        WriteLine ("Import process completed.");
-                       return 0;
                }
 
                static string Thumbprint (string algorithm, X509Certificate certificate)
@@ -179,8 +190,7 @@ namespace Mono.Tools
                                case "--user":
                                        userStore = true;
                                        break;
-                               case "--btls":
-                                       btlsStore = true;
+                               case "--btls": // we always import to the btls store too now, keep for compat
                                        break;
                                default:
                                        WriteLine ("Unknown option '{0}'.", args[i]);
index 55ab833cd1cd4b8064d33fb47a73890f7549560b..9e8ddb8e7fb908a040421fa20455014c6a3886e8 100644 (file)
       <resources></resources>
       <response>linkeranalyzer.exe.sources</response>
     </project>
-    <project dir="tools/btls" library="btls-cert-sync-net_4_x">
-      <boot></boot>
-      <flags>/codepage:65001 /nologo /noconfig /deterministic -d:NET_4_0 -d:NET_4_5 -d:NET_4_6 -d:MONO -d:WIN_PLATFORM -nowarn:1699 -nostdlib -r:./../../class/lib/net_4_x/mscorlib.dll /debug:portable -optimize -r:System -r:Mono.Security -r:Mono.Btls.Interface</flags>
-      <output>btls-cert-sync.exe</output>
-      <built_sources></built_sources>
-      <library_output>./../../class/lib/net_4_x/btls-cert-sync.exe</library_output>
-      <fx_version>4.5</fx_version>
-      <profile>net_4_x</profile>
-      <resources></resources>
-      <response>btls-cert-sync.exe.sources</response>
-    </project>
     <project dir="mcs" library="mcs-net_4_x">
       <boot></boot>
       <flags>/codepage:65001 /nologo /noconfig /deterministic -d:STATIC,NO_SYMBOL_WRITER,NO_AUTHENTICODE -d:MONO_FEATURE_THREAD_ABORT -d:MONO_FEATURE_PROCESS_START -d:NET_4_0 -d:NET_4_5 -d:NET_4_6 -d:MONO -d:WIN_PLATFORM -nowarn:1699 -nostdlib -r:./../class/lib/net_4_x/mscorlib.dll /debug:portable -optimize -r:System.Core -r:System.Xml -r:System</flags>
index 4b1ce16de33c54a1d51fa105dda38a3ec1412383..49a8a63a0380c7922f21f0daf467e9a5467042f7 100644 (file)
@@ -669,8 +669,6 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "mono-symbolicate-net_4_x",
 EndProject
 Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "linkeranalyzer-net_4_x", "mcs/tools/linker-analyzer/linkeranalyzer-net_4_x.csproj", "{D7789C48-C33A-4FE5-BD42-4DBAB2850796}"
 EndProject
-Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "btls-cert-sync-net_4_x", "mcs/tools/btls/btls-cert-sync-net_4_x.csproj", "{2323EB4F-0DBA-47C7-B4AA-AD38CCD16BF8}"
-EndProject
 Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "mcs-net_4_x", "mcs/mcs/mcs-net_4_x.csproj", "{322A755A-ED38-4295-979D-E49EBAFA2852}"
 EndProject
 Global
@@ -2015,10 +2013,6 @@ Global
                {D7789C48-C33A-4FE5-BD42-4DBAB2850796}.Debug|Any CPU.Build.0 = Debug|Any CPU
                {D7789C48-C33A-4FE5-BD42-4DBAB2850796}.Release|Any CPU.ActiveCfg = Release|Any CPU
                {D7789C48-C33A-4FE5-BD42-4DBAB2850796}.Release|Any CPU.Build.0 = Release|Any CPU
-               {2323EB4F-0DBA-47C7-B4AA-AD38CCD16BF8}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
-               {2323EB4F-0DBA-47C7-B4AA-AD38CCD16BF8}.Debug|Any CPU.Build.0 = Debug|Any CPU
-               {2323EB4F-0DBA-47C7-B4AA-AD38CCD16BF8}.Release|Any CPU.ActiveCfg = Release|Any CPU
-               {2323EB4F-0DBA-47C7-B4AA-AD38CCD16BF8}.Release|Any CPU.Build.0 = Release|Any CPU
                {322A755A-ED38-4295-979D-E49EBAFA2852}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
                {322A755A-ED38-4295-979D-E49EBAFA2852}.Debug|Any CPU.Build.0 = Debug|Any CPU
                {322A755A-ED38-4295-979D-E49EBAFA2852}.Release|Any CPU.ActiveCfg = Release|Any CPU
index 6b79de7dc529bc62358c670a28c8b3ac1d32736b..f7f8b3fe0e2c0cfd7a429d6a2c01942b2407dc68 100644 (file)
@@ -2,7 +2,6 @@
 /al
 /al1
 /al2
-/btls-cert-sync
 /caspol
 /cert-sync
 /cert2spc
index 6c2a338bc4adc481b3492127653b2d69b47e2a8e..62d350c79dda01e1d30428338ac3aa4066b66e2b 100644 (file)
@@ -74,7 +74,6 @@ scripts_4_0 = \
        prj2make$(SCRIPT_SUFFIX)                \
        soapsuds$(SCRIPT_SUFFIX)                \
        caspol$(SCRIPT_SUFFIX)                  \
-       btls-cert-sync$(SCRIPT_SUFFIX)          \
        cert-sync$(SCRIPT_SUFFIX)               \
        cert2spc$(SCRIPT_SUFFIX)                \
        certmgr$(SCRIPT_SUFFIX)                 \