From 18992842775bdbf4b783621f640359fdf1d254ee Mon Sep 17 00:00:00 2001 From: Slavasil Date: Mon, 1 Dec 2025 15:43:03 +0300 Subject: [PATCH] add IsLast property to PassStoreContentChunk - add special handling of the bit 23 in the 24-bit ChunkSize field - make the constructor set the property depending on that bit --- src/KeyKeeper/PasswordStore/Crypto/PassStoreContentChunk.cs | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/KeyKeeper/PasswordStore/Crypto/PassStoreContentChunk.cs b/src/KeyKeeper/PasswordStore/Crypto/PassStoreContentChunk.cs index 6d5301f..3321dc9 100644 --- a/src/KeyKeeper/PasswordStore/Crypto/PassStoreContentChunk.cs +++ b/src/KeyKeeper/PasswordStore/Crypto/PassStoreContentChunk.cs @@ -14,6 +14,7 @@ namespace KeyKeeper.PasswordStore.Crypto; /// public class PassStoreContentChunk { + public bool IsLast { get; } private byte[] chunk; private int chunkLen; @@ -45,6 +46,9 @@ public class PassStoreContentChunk throw PassStoreFileException.UnexpectedEndOfFile; } + IsLast = (chunkLen & (1 << 23)) != 0; + chunkLen &= ~(1 << 23); + if (chunk.Length != chunkLen + 3 + HMAC_SIZE) { throw PassStoreFileException.UnexpectedEndOfFile; @@ -104,6 +108,7 @@ public class PassStoreContentChunk { throw PassStoreFileException.UnexpectedEndOfFile; } + chunkLen &= ~(1 << 23); // 23 бит имеет специальное значение byte[] chunk = new byte[3 + HMAC_SIZE + chunkLen]; if (s.Read(chunk) < chunk.Length) {