Add support for using public key sent by Omaha.

This adds support for Omaha to specify what RSA public to use for
verifying both the metadata hash signature and the payload itself.

For security reasons, we only allow this for non-official builds
e.g. for official builds we keep using the key stored on the root
file-system.

Also, if the key is specified in the Omaha response then we make hash
checks mandatory; e.g. if the signatures don't check out, fail the
update.

See CL:175283 for the devserver changes to transmit the public key and
signed metadata hash.

BUG=chromium:264352
TEST=New unit tests + unit tests pass + manual testing.

Change-Id: I709be02662a484c6284bb78683b973554e482928
Reviewed-on: https://chromium-review.googlesource.com/175285
Reviewed-by: Don Garrett <dgarrett@chromium.org>
Commit-Queue: David Zeuthen <zeuthen@chromium.org>
Tested-by: David Zeuthen <zeuthen@chromium.org>
diff --git a/omaha_request_action.cc b/omaha_request_action.cc
index 5ce59bb..32b6530 100644
--- a/omaha_request_action.cc
+++ b/omaha_request_action.cc
@@ -53,6 +53,7 @@
 static const char* kTagSha256 = "sha256";
 static const char* kTagDisableP2PForDownloading = "DisableP2PForDownloading";
 static const char* kTagDisableP2PForSharing = "DisableP2PForSharing";
+static const char* kTagPublicKeyRsa = "PublicKeyRsa";
 
 namespace {
 
@@ -699,6 +700,8 @@
       (XmlGetProperty(pie_action_node, kTagDisableP2PForDownloading) == "true");
   output_object->disable_p2p_for_sharing =
       (XmlGetProperty(pie_action_node, kTagDisableP2PForSharing) == "true");
+  output_object->public_key_rsa =
+      XmlGetProperty(pie_action_node, kTagPublicKeyRsa);
 
   string max = XmlGetProperty(pie_action_node, kTagMaxFailureCountPerUrl);
   if (!base::StringToUint(max, &output_object->max_failure_count_per_url))