From b335f5b713dfdb4c9aa036cc3c43ed527819d53f Mon Sep 17 00:00:00 2001 From: Dietmar Maurer Date: Fri, 2 Aug 2019 10:00:15 +0200 Subject: [PATCH] src/bin/proxmox-backup-client.rs: sign index.json --- src/bin/proxmox-backup-client.rs | 4 ++-- src/client/http_client.rs | 7 ++++++- 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/src/bin/proxmox-backup-client.rs b/src/bin/proxmox-backup-client.rs index bffc49b9..d73dbec8 100644 --- a/src/bin/proxmox-backup-client.rs +++ b/src/bin/proxmox-backup-client.rs @@ -626,7 +626,7 @@ fn create_backup( if let Some(rsa_encrypted_key) = rsa_encrypted_key { let target = "rsa-encrypted.key"; println!("Upload RSA encoded key to '{:?}' as {}", repo, target); - let stats = client.upload_blob_from_data(rsa_encrypted_key, target, None, false).wait()?; + let stats = client.upload_blob_from_data(rsa_encrypted_key, target, None, false, false).wait()?; file_list.push((target.to_owned(), stats)); // openssl rsautl -decrypt -inkey master-private.pem -in rsa-encrypted.key -out t @@ -657,7 +657,7 @@ fn create_backup( println!("Upload index.json to '{:?}'", repo); let index_data = serde_json::to_string_pretty(&index)?.into(); - client.upload_blob_from_data(index_data, "index.json", crypt_config.clone(), true).wait()?; + client.upload_blob_from_data(index_data, "index.json", crypt_config.clone(), true, true).wait()?; client.finish().wait()?; diff --git a/src/client/http_client.rs b/src/client/http_client.rs index e6c41ccc..fa3680ab 100644 --- a/src/client/http_client.rs +++ b/src/client/http_client.rs @@ -597,6 +597,7 @@ impl BackupClient { file_name: &str, crypt_config: Option>, compress: bool, + sign_only: bool, ) -> impl Future { let h2 = self.h2.clone(); @@ -606,7 +607,11 @@ impl BackupClient { futures::future::ok(()) .and_then(move |_| { let blob = if let Some(ref crypt_config) = crypt_config { - DataBlob::encode(&data, Some(crypt_config), compress)? + if sign_only { + DataBlob::create_signed(&data, crypt_config, compress)? + } else { + DataBlob::encode(&data, Some(crypt_config), compress)? + } } else { DataBlob::encode(&data, None, compress)? };