Namespace LMKit.Cryptography
Classes
- EncryptedGguf
Produces and consumes encrypted GGUF containers whose tensor bytes can be decrypted in-place, on the fly, at any plaintext offset. The on-disk layout is:
[ 0.. 4) Magic "LMKE" [ 4.. 8) Format version (uint32 LE) = 1 [ 8.. 12) Encryption scheme (uint32 LE) see [12.. 28) PBKDF2 salt (16 bytes, random) [28.. 44) AES-CTR nonce (16 bytes, random, used as initial counter block) [44.. 48) PBKDF2 iteration count (uint32 LE) [48.. 56) Plaintext total size (uint64 LE) = size of original GGUF file [56.. 64) Plaintext metadata size (uint64 LE) = gguf_get_data_offset of original GGUF [64.. N) AES-CTR ciphertext of the full plaintext GGUF, byte-for-byteThe plaintext-to-ciphertext mapping is 1:1 (CTR is a stream cipher), so a plaintext offset P maps to container file offset (P + HeaderSize).
- EncryptedGguf.Reader
Reader over an encrypted GGUF container. Exposes the decrypted metadata block and an indexer that decrypts arbitrary plaintext byte ranges on demand.
Enums
- GgufEncryptionScheme
Encryption schemes supported by EncryptedGguf for GGUF model files.