[Mono.Security]: Add the new certificate store.
authorMartin Baulig <martin.baulig@xamarin.com>
Fri, 30 Sep 2016 11:08:26 +0000 (13:08 +0200)
committerMartin Baulig <martin.baulig@xamarin.com>
Fri, 30 Sep 2016 11:38:44 +0000 (13:38 +0200)
commitfb93be4490897141525ee95fb4bfb7413d5d0815
treea1a03f1e3a76a3596293f63e938f2f2b0fccf3d1
parent52b290680c59b0233e19c589420ca7d9050e6cac
[Mono.Security]: Add the new certificate store.

BTLS uses a different format and naming scheme for the local certificate store.

Before using BTLS for the first time on desktop, you need to convert the local
certificate store by either using the new `btls-cert-sync` tool (which will convert
your existing certificate store to the new new format) or `cert-sync` with the
`--btls` argument.

The new format and naming scheme is identically to what you'll find in
'/system/etc/security/cacerts/' on an Android device.  It stores the certificates
in PEM format (with a human-readable text section added) using filenames which
are based on the certificate's subject name hash.

Previously, Mono stored the certificates in binary DER format, using a filename
based on either the Subject-Key-Identifier (if available) or the thumbprint.

We cannot access this from BTLS because computing these filenames requires
reading the entire X509 certificate (including the X509v3 extensions), but
their native lookup code only gives us the SubjectName.

This transitioning won't affect Android users as we're using the system
certificate store (including the user certificate store, via a Java callback).

* Mono.Security.X509.X509Store and X509Stores:
  Support both the old and the new format.  Using the new format requires BTLS.

* Mono.Security.X509.X509StoreManager:
  Add `NewCurrentUserPath` and `NewLocalMachinePath` properties for the
  new path names (~/.config/.mono/new-certs).

* Mono.Security.X509.X509StoreManager:
  Add `NewCurrentUser` and `NewLocalMachine` properties.  Requires BTLS.

* tools/security/cert-sync:
  Add new `--btls` argument to use the new store.
mcs/class/Mono.Security/Mono.Security.X509/X509Store.cs
mcs/class/Mono.Security/Mono.Security.X509/X509StoreManager.cs
mcs/class/Mono.Security/Mono.Security.X509/X509Stores.cs
mcs/tools/security/cert-sync.cs