Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(974)

Unified Diff: generate_delta_main.cc

Issue 6271003: AU: Support signed payload verification through the delta generator. (Closed) Base URL: ssh://git@gitrw.chromium.org:9222/update_engine.git@master
Patch Set: Created 9 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « delta_performer_unittest.cc ('k') | omaha_hash_calculator.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: generate_delta_main.cc
diff --git a/generate_delta_main.cc b/generate_delta_main.cc
index 9fc7fd7786d9c0117f485c0cde9148a9137ac363..0f791e0b509dfb6cbbb16ead976e394df4789fdc 100644
--- a/generate_delta_main.cc
+++ b/generate_delta_main.cc
@@ -40,6 +40,7 @@ DEFINE_string(in_file, "",
DEFINE_string(out_file, "", "Path to output delta payload file");
DEFINE_string(out_hash_file, "", "Path to output hash file");
DEFINE_string(private_key, "", "Path to private key in .pem format");
+DEFINE_string(public_key, "", "Path to public key in .pem format");
DEFINE_string(prefs_dir, "/tmp/update_engine_prefs",
"Preferences directory, used with apply_delta");
DEFINE_int32(signature_size, 0, "Raw signature size used for hash calculation");
@@ -94,6 +95,16 @@ void SignPayload() {
LOG(INFO) << "Done signing payload.";
}
+void VerifySignedPayload() {
+ LOG(INFO) << "Verifying signed payload.";
+ LOG_IF(FATAL, FLAGS_in_file.empty())
+ << "Must pass --in_file to verify signed payload.";
+ LOG_IF(FATAL, FLAGS_public_key.empty())
+ << "Must pass --public_key to verify signed payload.";
+ CHECK(PayloadSigner::VerifySignedPayload(FLAGS_in_file, FLAGS_public_key));
+ LOG(INFO) << "Done verifying signed payload.";
+}
+
void ApplyDelta() {
LOG(INFO) << "Applying delta.";
LOG_IF(FATAL, FLAGS_old_image.empty())
@@ -154,6 +165,10 @@ int Main(int argc, char** argv) {
SignPayload();
return 0;
}
+ if (!FLAGS_public_key.empty()) {
+ VerifySignedPayload();
+ return 0;
+ }
if (!FLAGS_in_file.empty()) {
ApplyDelta();
return 0;
« no previous file with comments | « delta_performer_unittest.cc ('k') | omaha_hash_calculator.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698