]> git.proxmox.com Git - proxmox-backup.git/commitdiff
Fingerprint: add new signature method
authorDietmar Maurer <dietmar@proxmox.com>
Mon, 22 Nov 2021 07:19:09 +0000 (08:19 +0100)
committerDietmar Maurer <dietmar@proxmox.com>
Mon, 22 Nov 2021 07:29:43 +0000 (08:29 +0100)
commit c42a54795df332cd778a53ea500b901ae873c81d introcuded a bug by
using fp.to_string(). Replace this with fp.signature() which correctly
returns the full fingerprint instead of the short version.

Signed-off-by: Dietmar Maurer <dietmar@proxmox.com>
pbs-api-types/src/crypto.rs
pbs-config/src/key_config.rs
pbs-config/src/tape_encryption_keys.rs
src/api2/tape/drive.rs
src/tape/drive/lto/mod.rs

index eda92e23ea09ebbc9f2e45f0eb68851c6f03ff09..6f931f8f2c15845e4677030a5eef21a8c6d63cf3 100644 (file)
@@ -33,6 +33,9 @@ impl Fingerprint {
     pub fn bytes(&self) -> &[u8; 32] {
         &self.bytes
     }
+    pub fn signature(&self) -> String {
+        as_fingerprint(&self.bytes)
+    }
 }
 
 /// Display as short key ID
index def83aba6c6fc644d1e3cf922a6dced336d70217..8c20cff374c18f28058f08dc512834b45d3c830c 100644 (file)
@@ -100,7 +100,7 @@ impl From<&KeyConfig> for KeyInfo {
             fingerprint: key_config
                 .fingerprint
                 .as_ref()
-                .map(|fp| fp.to_string()),
+                .map(|fp| fp.signature()),
             hint: key_config.hint.clone(),
         }
     }
index eb34bdd6a8ae1b3fe731ed22de98149aaf560449..e40975c73db3c4305dce1304c916ea2f17372d59 100644 (file)
@@ -190,5 +190,5 @@ pub fn complete_key_fingerprint(_arg: &str, _param: &HashMap<String, String>) ->
         Err(_) => return Vec::new(),
     };
 
-    data.keys().map(|fp| fp.to_string()).collect()
+    data.keys().map(|fp| fp.signature()).collect()
 }
index 3ef2950c2d60fef74e97231d8145adfe786d6ae6..ba2dad7051b17e4a81bb39bff30a2d7394be48da 100644 (file)
@@ -696,7 +696,7 @@ pub async fn read_label(
                         flat.encryption_key_fingerprint = set
                             .encryption_key_fingerprint
                             .as_ref()
-                            .map(|fp| fp.to_string());
+                            .map(|fp| fp.signature());
 
                         let encrypt_fingerprint = set.encryption_key_fingerprint.clone()
                             .map(|fp| (fp, set.uuid.clone()));
index 1ba706ef2e323cd0ce42dc3536ee31cbb2b3d29c..78413f94548ce453524a32a350edd574fc207072 100644 (file)
@@ -317,7 +317,7 @@ impl TapeDriver for LtoTapeHandle {
         }
 
         let output = if let Some((fingerprint, uuid)) = key_fingerprint {
-            let fingerprint = fingerprint.to_string();
+            let fingerprint = fingerprint.signature();
             run_sg_tape_cmd("encryption", &[
                 "--fingerprint", &fingerprint,
                 "--uuid", &uuid.to_string(),