]> git.proxmox.com Git - proxmox-backup.git/commitdiff
fix: master-key: upload RSA encoded key with backup
authorDylan Whyte <d.whyte@proxmox.com>
Thu, 6 Aug 2020 07:13:40 +0000 (09:13 +0200)
committerDietmar Maurer <dietmar@proxmox.com>
Thu, 6 Aug 2020 07:34:01 +0000 (09:34 +0200)
When uploading an RSA encoded key alongside the backup,
the backup would fail with the error message: "wrong blob
file extension".
Adding the '.blob' extension to rsa-encrypted.key before the
the call to upload_blob_from_data(), rather than after, fixes
the issue.

Signed-off-by: Dylan Whyte <d.whyte@proxmox.com>
src/bin/proxmox-backup-client.rs

index 16c6ec66062998806637cf7a2367789a227e8342..a70566856e1f527d0dfd1e93894a1db8b2d07b1e 100644 (file)
@@ -1120,12 +1120,12 @@ async fn create_backup(
     }
 
     if let Some(rsa_encrypted_key) = rsa_encrypted_key {
-        let target = "rsa-encrypted.key";
+        let target = "rsa-encrypted.key.blob";
         println!("Upload RSA encoded key to '{:?}' as {}", repo, target);
         let stats = client
             .upload_blob_from_data(rsa_encrypted_key, target, false, false)
             .await?;
-        manifest.add_file(format!("{}.blob", target), stats.size, stats.csum, crypt_mode)?;
+        manifest.add_file(target.to_string(), stats.size, stats.csum, crypt_mode)?;
 
         // openssl rsautl -decrypt -inkey master-private.pem -in rsa-encrypted.key -out t
         /*
@@ -1136,7 +1136,6 @@ async fn create_backup(
         println!("TEST {} {:?}", len, buffer2);
          */
     }
-
     // create manifest (index.json)
     // manifests are never encrypted, but include a signature
     let manifest = manifest.to_string(crypt_config.as_ref().map(Arc::as_ref))