update_engine: Add --properties_format flag to delta_generator

We need to be able to capture information about a payload by just
looking at it. These information needed for nebraska to be able to
process a response from a request. These information includes:
- Payload and its metadata hashes and sizes.
- Payload metadata signature.
- The APP ID of the original image.
- Whether the payload is a delta or full.
- The payload's target version.

This CL adds the ability to generate a json file with the payloads
properties such as above.

Also this CL refactors how this information is generated into a single
class.

BUG=chromium:960433
TEST=delta_generator --in_file=hello-signed-delta --properties_file=prop
TEST=delta_generator --in_file=hello-signed-delta
--properties_file=payload.json --properties_format="json"

Change-Id: Ia61be0bf37bcacfd82f8982a7977fdae2f18cb30
Reviewed-on: https://chromium-review.googlesource.com/1610801
Tested-by: Amin Hassani <ahassani@chromium.org>
Commit-Ready: ChromeOS CL Exonerator Bot <chromiumos-cl-exonerator@appspot.gserviceaccount.com>
Legacy-Commit-Queue: Commit Bot <commit-bot@chromium.org>
Reviewed-by: Sen Jiang <senj@chromium.org>
Reviewed-by: Nicolas Norvez <norvez@chromium.org>
diff --git a/payload_consumer/payload_metadata.h b/payload_consumer/payload_metadata.h
index 1b4c5c8..ec8eea6 100644
--- a/payload_consumer/payload_metadata.h
+++ b/payload_consumer/payload_metadata.h
@@ -86,6 +86,13 @@
   bool GetManifest(const brillo::Blob& payload,
                    DeltaArchiveManifest* out_manifest) const;
 
+  // Parses a payload file |payload_path| and prepares the metadata properties,
+  // manifest and metadata signatures. Can be used as an easy to use utility to
+  // get the payload information without manually the process.
+  bool ParsePayloadFile(const std::string& payload_path,
+                        DeltaArchiveManifest* manifest,
+                        Signatures* metadata_signatures);
+
  private:
   // Set |*out_offset| to the byte offset at which the manifest protobuf begins
   // in a payload. Return true on success, false if the offset is unknown.