Verify AU payload manifest signature if present.

In order to support downloads over http for a number of reasons, we need
to secure http downloads. The first step in this process is to
verify the signature of the manifest itself before parsing. This can be
done even for https-based downloads in order to provide defense-in-depth
against a SSL attack. This CL adds the required verification logic in
update_engine, if such a manifest signature is present in the Omaha
response.

Until the delta generator is modified in a subsequent check-in to update
the manifest and payload with the required signature, none of this new
code will have any effect.

The delta generator change to populate non-zero values for these new
fields will follow in subsequent CLs.

BUG=chromium-os:33602
TEST=Tested on ZGB to make sure existing functionality works fine.
     Added new unit tests.
Change-Id: I2d8b09c23faf87049893b1dee97a34e1f300aded
Reviewed-on: https://gerrit.chromium.org/gerrit/32844
Commit-Ready: Jay Srinivasan <jaysri@chromium.org>
Reviewed-by: Jay Srinivasan <jaysri@chromium.org>
Tested-by: Jay Srinivasan <jaysri@chromium.org>
diff --git a/omaha_hash_calculator.h b/omaha_hash_calculator.h
index 784326a..a9c59d4 100644
--- a/omaha_hash_calculator.h
+++ b/omaha_hash_calculator.h
@@ -74,8 +74,14 @@
   static std::string OmahaHashOfString(const std::string& str);
   static std::string OmahaHashOfData(const std::vector<char>& data);
 
+  // Encodes data of given size as a base64 out string
   static bool Base64Encode(const void* data, size_t size, std::string* out);
 
+  // Decodes given base64-encoded in string into the out vector. Since the
+  // output can have null characters, we're returning a byte vector instead of
+  // a string.
+  static bool Base64Decode(const std::string& in, std::vector<char>* out);
+
  private:
   // If non-empty, the final base64 encoded hash and the raw hash. Will only be
   // set to non-empty when Finalize is called.