[pbs-devel] [PATCH proxmox-backup 09/13] paperkey: add short key ID to subject

Dietmar Maurer dietmar at proxmox.com
Mon Nov 23 09:55:50 CET 2020


> > I still don't get why we need a 32byte fingerprint - this is the same length as the key itself!
> 
> the key (on disk) is 8 + 8 + 8 + 32 (key derivation) + 64 (encrypted key 
> data) + 8 + 8 (timestamps), totalling 136 bytes. serialized it's a bit 
> more, although there the fingerprint skews the numbers more heavily 
> (because I opted for a readable serialization, not one optimized for 
> size). even in-memory, the key is not 32-byte long, but 32+32+however 
> long the PKey struct from openssl is.

For the record, the fingerprint is computed using 32 secret bytes (not more). 

Note: FINGERPRINT_INPUT is const

+    pub fn fingerprint(&self) -> Fingerprint {
+        Fingerprint {
+            bytes: self.compute_digest(&FINGERPRINT_INPUT)
+        }
+    }
+

    pub fn compute_digest(&self, data: &[u8]) -> [u8; 32] {
        let mut hasher = openssl::sha::Sha256::new();
        hasher.update(data); // this is const
        hasher.update(&self.id_key); // this is 32 bytes
        hasher.finish()
    }

So the fingerprint has exactly the same size as the secret key.
I really do not understand your arguments...





More information about the pbs-devel mailing list