diff --git a/src/lib.rs b/src/lib.rs index 3b4614d..cba3b56 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -513,8 +513,6 @@ impl BackupDecryptor { Err(e) => return Err(e), }; - // if we got to an attachment, but there we demand more data, it will be faulty, because we try to decrypt the frame although we would need - // to decrypt the attachment match decrypt_frame( &mut self.reader, hmac, @@ -524,6 +522,8 @@ impl BackupDecryptor { frame_length, ) { Ok(None) => { + // here we have to reset as well because the hmac depends on the length decryption which should therefore happen next time on the correct bits + self.reader.set_position(initial_reader_position); return Ok(true); } Ok(Some(backup_frame)) => { diff --git a/test/src/App.tsx b/test/src/App.tsx index 934806f..b86955a 100644 --- a/test/src/App.tsx +++ b/test/src/App.tsx @@ -133,6 +133,7 @@ const App: Component = () => { { setBackupFile(event.currentTarget.files?.[0]); }}