Imported Upstream version 4.3.2.467

Former-commit-id: 9c2cb47f45fa221e661ab616387c9cda183f283d
This commit is contained in:
Xamarin Public Jenkins
2016-02-22 11:00:01 -05:00
parent f302175246
commit f3e3aab35a
4097 changed files with 122406 additions and 82300 deletions

View File

@@ -49,6 +49,7 @@ namespace Mono.Tools
static string inputFile;
static bool quiet;
static bool userStore;
static X509Certificate DecodeCertificate (string s)
{
@@ -115,7 +116,7 @@ namespace Mono.Tools
return 0;
}
X509Stores stores = (X509StoreManager.LocalMachine);
X509Stores stores = userStore ? X509StoreManager.CurrentUser : X509StoreManager.LocalMachine;
X509CertificateCollection trusted = stores.TrustedRoot.Certificates;
int additions = 0;
WriteLine ("I already trust {0}, your new list has {1}", trusted.Count, roots.Count);
@@ -124,10 +125,11 @@ namespace Mono.Tools
try {
stores.TrustedRoot.Import (root);
WriteLine ("Certificate added: {0}", root.SubjectName);
} catch {
WriteLine ("Warning: Could not import {0}");
additions++;
} catch (Exception e) {
WriteLine ("Warning: Could not import {0}", root.SubjectName);
WriteLine (e.ToString ());
}
additions++;
}
}
if (additions > 0)
@@ -168,14 +170,17 @@ namespace Mono.Tools
case "--quiet":
quiet = true;
break;
case "--user":
userStore = true;
break;
default:
WriteLine ("Unknown option '{0}'.");
WriteLine ("Unknown option '{0}'.", args[i]);
return false;
}
}
inputFile = args [args.Length - 1];
if (!File.Exists (inputFile)) {
WriteLine ("Unknown option or file not found '{0}'.");
WriteLine ("Unknown option or file not found '{0}'.", inputFile);
return false;
}
return true;
@@ -188,7 +193,7 @@ namespace Mono.Tools
static void Help ()
{
Console.WriteLine ("Usage: cert-sync [--quiet] system-ca-bundle.crt");
Console.WriteLine ("Usage: cert-sync [--quiet] [--user] system-ca-bundle.crt");
Console.WriteLine ("Where system-ca-bundle.crt is in PEM format");
}

View File

@@ -105,7 +105,7 @@ namespace Mono.Tools {
RSA subjectKey = (RSA)RSA.Create ();
bool selfSigned = false;
string hashName = "SHA1";
string hashName = "SHA512";
CspParameters subjectParams = new CspParameters ();
CspParameters issuerParams = new CspParameters ();
@@ -150,11 +150,18 @@ namespace Mono.Tools {
case "-a":
// hash algorithm
switch (args [i++].ToLower ()) {
case "sha512":
hashName = "SHA512";
break;
case "sha256":
hashName = "SHA256";
break;
case "sha1":
Console.WriteLine ("WARNING: SHA1 is not safe for this usage.");
hashName = "SHA1";
break;
case "md5":
Console.WriteLine ("WARNING: MD5 is no more safe for this usage.");
Console.WriteLine ("WARNING: MD5 is not safe for this usage.");
hashName = "MD5";
break;
default:

View File

@@ -35,7 +35,7 @@ namespace Mono.Tools {
Console.WriteLine ("Usage: signcode [options] filename{0}", Environment.NewLine);
Console.WriteLine ("\t-spc spc\tSoftware Publisher Certificate file");
Console.WriteLine ("\t-v pvk\t\tPrivate Key file");
Console.WriteLine ("\t-a md5 | sha1\tHash Algorithm (default: MD5)");
Console.WriteLine ("\t-a sha1 | md5\tHash Algorithm (default: SHA1)");
Console.WriteLine ("\t-$ indivisual | commercial\tSignature type");
Console.WriteLine ("\t-n description\tDescription for the signed file");
Console.WriteLine ("\t-i url\tURL for the signed file");