diff options
author | Alexander Köplinger <alex.koeplinger@outlook.com> | 2017-01-13 16:42:50 +0300 |
---|---|---|
committer | Alexander Köplinger <alex.koeplinger@outlook.com> | 2017-01-13 16:58:39 +0300 |
commit | cd26828a8e4f070b1e49489a4f4d17fa47a58348 (patch) | |
tree | c688fdf535ed0d6e5cb1ea5659dc967b31031d63 | |
parent | cf9ec6d7151e1e6b4c3fddc9410705f1e43b7fd5 (diff) |
[btls] Remove btls-cert-sync and integrate it into cert-syncmono-4.8.0.459gtk-viewport-allocation
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.
(cherry picked from commit 968c60a0f32c7a4c92568c3feda7503f99b98c94)
-rw-r--r-- | mcs/class/System/Assembly/AssemblyInfo.cs | 1 | ||||
-rw-r--r-- | mcs/tools/Makefile | 3 | ||||
-rw-r--r-- | mcs/tools/btls/AssemblyInfo.cs | 26 | ||||
-rw-r--r-- | mcs/tools/btls/Makefile | 17 | ||||
-rw-r--r-- | mcs/tools/btls/btls-cert-sync.cs | 61 | ||||
-rw-r--r-- | mcs/tools/btls/btls-cert-sync.exe.sources | 4 | ||||
-rw-r--r-- | mcs/tools/security/cert-sync.cs | 38 | ||||
-rw-r--r-- | scripts/.gitignore | 1 | ||||
-rw-r--r-- | scripts/Makefile.am | 1 |
9 files changed, 25 insertions, 127 deletions
diff --git a/mcs/class/System/Assembly/AssemblyInfo.cs b/mcs/class/System/Assembly/AssemblyInfo.cs index 6ed83d7c1e0..3cc6917f4af 100644 --- a/mcs/class/System/Assembly/AssemblyInfo.cs +++ b/mcs/class/System/Assembly/AssemblyInfo.cs @@ -74,7 +74,6 @@ using System.Runtime.InteropServices; [assembly: StringFreezing] [assembly: DefaultDependency (LoadHint.Always)] - [assembly: InternalsVisibleTo ("btls-cert-sync, PublicKey=002400000480000094000000060200000024000052534131000400000100010079159977d2d03a8e6bea7a2e74e8d1afcc93e8851974952bb480a12c9134474d04062447c37e0e68c080536fcf3c3fbe2ff9c979ce998475e506e8ce82dd5b0f350dc10e93bf2eeecf874b24770c5081dbea7447fddafa277b22de47d6ffea449674a4f9fccf84d15069089380284dbdd35f46cdff12a1bd78e4ef0065d016df")] [assembly: InternalsVisibleTo ("Mono.Btls.Interface, PublicKey=002400000480000094000000060200000024000052534131000400000100010079159977d2d03a8e6bea7a2e74e8d1afcc93e8851974952bb480a12c9134474d04062447c37e0e68c080536fcf3c3fbe2ff9c979ce998475e506e8ce82dd5b0f350dc10e93bf2eeecf874b24770c5081dbea7447fddafa277b22de47d6ffea449674a4f9fccf84d15069089380284dbdd35f46cdff12a1bd78e4ef0065d016df")] [assembly: InternalsVisibleTo ("Mono.Security, PublicKey=002400000480000094000000060200000024000052534131000400000100010079159977d2d03a8e6bea7a2e74e8d1afcc93e8851974952bb480a12c9134474d04062447c37e0e68c080536fcf3c3fbe2ff9c979ce998475e506e8ce82dd5b0f350dc10e93bf2eeecf874b24770c5081dbea7447fddafa277b22de47d6ffea449674a4f9fccf84d15069089380284dbdd35f46cdff12a1bd78e4ef0065d016df")] diff --git a/mcs/tools/Makefile b/mcs/tools/Makefile index af120d403ed..693318cbea7 100644 --- a/mcs/tools/Makefile +++ b/mcs/tools/Makefile @@ -47,8 +47,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 index 06f8d61c8d2..00000000000 --- a/mcs/tools/btls/AssemblyInfo.cs +++ /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 index b551fa782c6..00000000000 --- a/mcs/tools/btls/Makefile +++ /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.cs b/mcs/tools/btls/btls-cert-sync.cs deleted file mode 100644 index fcdc708e0ab..00000000000 --- a/mcs/tools/btls/btls-cert-sync.cs +++ /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 index 706d78f894b..00000000000 --- a/mcs/tools/btls/btls-cert-sync.exe.sources +++ /dev/null @@ -1,4 +0,0 @@ -../../build/common/SR.cs -../../build/common/Consts.cs -AssemblyInfo.cs -btls-cert-sync.cs diff --git a/mcs/tools/security/cert-sync.cs b/mcs/tools/security/cert-sync.cs index 56797562e50..b7b77f8f766 100644 --- a/mcs/tools/security/cert-sync.cs +++ b/mcs/tools/security/cert-sync.cs @@ -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]); diff --git a/scripts/.gitignore b/scripts/.gitignore index a22d2a91ff4..a036cf1f8db 100644 --- a/scripts/.gitignore +++ b/scripts/.gitignore @@ -2,7 +2,6 @@ /al /al1 /al2 -/btls-cert-sync /caspol /cert-sync /cert2spc diff --git a/scripts/Makefile.am b/scripts/Makefile.am index 39595455dad..51a160c36c7 100644 --- a/scripts/Makefile.am +++ b/scripts/Makefile.am @@ -73,7 +73,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) \ |