Imported Upstream version 4.8.0.459

Former-commit-id: 2a5b9df2014f72665850c7f885e7aed54704a53a
This commit is contained in:
Xamarin Public Jenkins (auto-signing)
2017-01-19 14:22:10 +00:00
parent a355c1b831
commit e5cd25ff4f
725 changed files with 1215 additions and 107650 deletions

View File

@@ -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

View File

@@ -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")]

View File

@@ -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

View File

@@ -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);
}
}
}

View File

@@ -1,4 +0,0 @@
../../build/common/SR.cs
../../build/common/Consts.cs
AssemblyInfo.cs
btls-cert-sync.cs

View File

@@ -200,7 +200,7 @@ namespace CorCompare
if (File.Exists (assembly))
return TypeHelper.Resolver.ResolveFile (assembly);
return TypeHelper.Resolver.Resolve (assembly);
return TypeHelper.Resolver.Resolve (AssemblyNameReference.Parse (assembly), new ReaderParameters ());
} catch (Exception e) {
Console.WriteLine (e);
return null;

View 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]);