From a83e4674ad20f4db1ff292a5618c055b56ae3520 Mon Sep 17 00:00:00 2001 From: Hatter Jiang Date: Sun, 12 Feb 2023 21:23:47 +0800 Subject: [PATCH] feat: add tiny encrypt spec v1.1 --- TinyEncryptSpecV1.1.md | 37 +++++++++++++++++++++++++++++++++++++ 1 file changed, 37 insertions(+) create mode 100644 TinyEncryptSpecV1.1.md diff --git a/TinyEncryptSpecV1.1.md b/TinyEncryptSpecV1.1.md new file mode 100644 index 0000000..5cb1d5d --- /dev/null +++ b/TinyEncryptSpecV1.1.md @@ -0,0 +1,37 @@ + +File ext: `*.tinyenc` + +File format: + +```text +[TAG; 2 bytes; short; BE; Always 1] +[LENGTH; 4 bytes; int; BE] +[META; LENGTH bytes] +[ENCRYPTED_DATA; n bytes; AES/GCM] +``` + +Meta format: + +| Field | Type | Comment | +|---------|---------|---------------------------------------------| +| version | String | Constant value: `1.1` | +| created | Long | Created time, Unix Epoch | +| userAgent | String | User Agent, e.g. `TinyEncrypt v0.5.1@MacOS` | +| comment | String | Plain text comment | +| encryptedComment | String | Encrypted comment | +| pgpEnvelop | String | Deprecated PGP Publickey Encrypted DataKey | +| pgpFingerprint | String | Deprecated Hex(Sha256(PGP Publickey)) | +| envelop | String | Deprecated KMS Encrypted DataKey | +| envelops | Envelop[] | Envelop Array | +| nonce | byte[] | GCM Nonce | +| fileLength | Long | File Length | +| fileLastModified | Long | File Last Modified | +| compress | Boolean | Compress or not | + +Envelop format: + +| Field | Type | Comment | +|--------------|--------|-------------------| +| type | String | `kms`, `pgp`, ... | +| kid | String | Key ID | +| encryptedKey | String | Encrypted Key | \ No newline at end of file