]> git.proxmox.com Git - proxmox-backup.git/commitdiff
src/backup/data_blob.rs: add is_encrypted helper
authorDietmar Maurer <dietmar@proxmox.com>
Thu, 24 Sep 2020 10:36:04 +0000 (12:36 +0200)
committerDietmar Maurer <dietmar@proxmox.com>
Thu, 24 Sep 2020 11:00:16 +0000 (13:00 +0200)
src/backup/data_blob.rs

index ef11765efe933ce7e91ce4cea63edf4c63427924..284dc24321eb2cb2d8a281f262f78c024e40ee0a 100644 (file)
@@ -271,6 +271,12 @@ impl DataBlob {
         }
     }
 
+    /// Returns if chunk is encrypted
+    pub fn is_encrypted(&self) -> bool {
+        let magic = self.magic();
+        magic == &ENCR_COMPR_BLOB_MAGIC_1_0 || magic == &ENCRYPTED_BLOB_MAGIC_1_0
+    }
+
     /// Verify digest and data length for unencrypted chunks.
     ///
     /// To do that, we need to decompress data first. Please note that