|
2 | 2 |
|
3 | 3 | ## Header format |
4 | 4 |
|
5 | | -* The items in the header are as followed (square brackets representing the start and end of the header, anything in braces is related to the previous option). Newlines and tabs are not true, but simply for formatting: |
| 5 | +* At the start of the header, it is marked by 5 null characters (byte value 0000 0000), and then the following ASCII string: "BEGIN ENCRYPTION HEADER STRING" |
| 6 | + |
| 7 | +* The end of the header is marked by the following ASCII string "END ENCRYPTION HEADER STRING", and followed by 5 null characters (byte value 0000 0000) |
| 8 | + |
| 9 | +* The items in the header are as followed (square brackets representing the start and end of the header, anything in braces is related to the previous option). All whitespace but simply for formatting: |
6 | 10 |
|
7 | 11 | ``` |
8 | 12 | [ |
9 | 13 | -HMAC:(hash here, None) |
10 | | - { -HASHALGO:(PBKDF2, SHA256, bcrypt) } |
11 | | - { -ITERATIONS:(iterations here) } |
12 | | --KEYVERIFICATIONHASH:(hash here, None) |
13 | | - { -HASHALGO:(PBKDF2, SHA256, bcrypt) } |
14 | | - { -ITERATIONS:(iterations here) } |
| 14 | + { |
| 15 | + -HASHALGO:(PBKDF2, SHA256, bcrypt), |
| 16 | + -ITERATIONS:(iterations here) |
| 17 | + } |
| 18 | +
|
15 | 19 | -ENCRYPTMODE:(AES, RSA, etc) |
16 | | - {{-AESMODE:(ECB, CBC, CFB, CTR), |
17 | | - -ECCMODE:(different curves fo here)} |
18 | | - -KEYSIZE: (int) |
19 | | - -BLOCKSIZE: (int) |
| 20 | + { |
| 21 | + -AESMODE:(ECB, CBC, CFB, CTR), |
| 22 | + -ECCMODE:(different curves fo here), |
| 23 | + -KEYSIZE:(int), |
| 24 | + -BLOCKSIZE:(int) |
20 | 25 | } |
21 | | - { -IV:(IV here) } |
| 26 | +
|
| 27 | +-IV:(IV here) |
22 | 28 | ] |
23 | 29 | ``` |
24 | 30 |
|
25 | 31 | ## Header items |
26 | 32 |
|
27 | | -| Argument | Meaning | Values| |
28 | | -| ------------------------------------------------------ |-------------------------------- | ------------------------------------ | |
29 | | -| <a href="#HMAC">HMAC</a> | The verification hash used to confirm the file hasn't changed | 128 - 512 bit byte array (16-64 bytes) | |
30 | | -| <a href="#KEYVERIFICATIONHASH">KEYVERIFICATIONHASH</a> | A hash of the key to verify if the password is correct | 128 - 512 bit byte array (16-64 bytes) | |
31 | | -| <a href="#ENCRYPTMODE">ENCRYPTMODE</a> | A byte representing the encryption type | A string in the table of <a href="#ENCRYPTMODE">ENCRYPTMODE</a> page, and the (undefined ATM -- TODO) enumeration | |
| 33 | +* Subitems are in the hyperlinks |
| 34 | + |
| 35 | +| Argument | Meaning | Values | |
| 36 | +| ------------------------------------------------------ |-------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------- | |
| 37 | +| <a href="#HMAC">HMAC</a> | The verification hash used to confirm the file hasn't changed | 128 - 512 bit byte array (16-64 bytes) | |
| 38 | +| <a href="#ENCRYPTMODE">ENCRYPTMODE</a> | A byte representing the encryption type | A string in the table of <a href="#ENCRYPTMODE">ENCRYPTMODE</a> page, and the (undefined ATM -- TODO) enumeration | |
| 39 | +| <a href="IV">IV</a> | The initialization vector used to start the encryption | 128 - 512 bit byte array (16-64 bytes) | |
| 40 | + |
32 | 41 |
|
33 | 42 | ### <p id="HMAC">HMAC</p> |
34 | 43 |
|
35 | | -### <p id="KEYVERIFICATIONHASH">KEYVERIFICATIONHASH</p> |
| 44 | +The HMAC (Hash Message Authentication Code) is a hash that is used to verify the message hasn't been tampered with. The HMAC is the hashed value of the encrypted message. The receiver can re-hash the received message to verify the message hasn't been tampered with. **IMPORTANT: HMAC construction MUST be actual HMAC algorithm, not just hashing. See [this](https://en.wikipedia.org/wiki/HMAC#Implementation) for details **** |
36 | 45 |
|
37 | 46 | ### <p id ="ENCRYPTMODE">ENCRYPTMODE</P> |
| 47 | + |
| 48 | +### <p id="IV">IV</p> |
0 commit comments