Fingerprint: add new signature method

commit c42a54795d 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>
This commit is contained in:
Dietmar Maurer 2021-11-22 08:19:09 +01:00
parent 94a6b33680
commit ca6e66aa5a
5 changed files with 7 additions and 4 deletions

View File

@ -33,6 +33,9 @@ impl Fingerprint {
pub fn bytes(&self) -> &[u8; 32] { pub fn bytes(&self) -> &[u8; 32] {
&self.bytes &self.bytes
} }
pub fn signature(&self) -> String {
as_fingerprint(&self.bytes)
}
} }
/// Display as short key ID /// Display as short key ID

View File

@ -100,7 +100,7 @@ impl From<&KeyConfig> for KeyInfo {
fingerprint: key_config fingerprint: key_config
.fingerprint .fingerprint
.as_ref() .as_ref()
.map(|fp| fp.to_string()), .map(|fp| fp.signature()),
hint: key_config.hint.clone(), hint: key_config.hint.clone(),
} }
} }

View File

@ -190,5 +190,5 @@ pub fn complete_key_fingerprint(_arg: &str, _param: &HashMap<String, String>) ->
Err(_) => return Vec::new(), Err(_) => return Vec::new(),
}; };
data.keys().map(|fp| fp.to_string()).collect() data.keys().map(|fp| fp.signature()).collect()
} }

View File

@ -696,7 +696,7 @@ pub async fn read_label(
flat.encryption_key_fingerprint = set flat.encryption_key_fingerprint = set
.encryption_key_fingerprint .encryption_key_fingerprint
.as_ref() .as_ref()
.map(|fp| fp.to_string()); .map(|fp| fp.signature());
let encrypt_fingerprint = set.encryption_key_fingerprint.clone() let encrypt_fingerprint = set.encryption_key_fingerprint.clone()
.map(|fp| (fp, set.uuid.clone())); .map(|fp| (fp, set.uuid.clone()));

View File

@ -317,7 +317,7 @@ impl TapeDriver for LtoTapeHandle {
} }
let output = if let Some((fingerprint, uuid)) = key_fingerprint { let output = if let Some((fingerprint, uuid)) = key_fingerprint {
let fingerprint = fingerprint.to_string(); let fingerprint = fingerprint.signature();
run_sg_tape_cmd("encryption", &[ run_sg_tape_cmd("encryption", &[
"--fingerprint", &fingerprint, "--fingerprint", &fingerprint,
"--uuid", &uuid.to_string(), "--uuid", &uuid.to_string(),