Skip to content

Commit 4ad0839

Browse files
author
Lee Miller
committed
Edit Encryption doc: add MAC, reformat pubkeys, add a footnote about padding
1 parent a961398 commit 4ad0839

File tree

1 file changed

+50
-28
lines changed

1 file changed

+50
-28
lines changed

docs/encryption.rst

Lines changed: 50 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ Encryption
4444
5. Use the X component of public key P and calculate the SHA512 hash H.
4545
6. The first 32 bytes of H are called key_e and the last 32 bytes are called
4646
key_m.
47-
7. Pad the input text to a multiple of 16 bytes, in accordance to PKCS7.
47+
7. Pad the input text to a multiple of 16 bytes, in accordance to PKCS7. [#f1]_
4848
8. Encrypt the data with AES-256-CBC, using IV as initialization vector,
4949
key_e as encryption key and the padded input text as payload. Call the
5050
output cipher text.
@@ -84,15 +84,15 @@ Partial Example
8484

8585
::
8686

87-
04 09 d4 e5 c0 ab 3d 25
88-
fe 04 8c 64 c9 da 1a 24
89-
2c 7f 19 41 7e 95 17 cd
90-
26 69 50 d7 2c 75 57 13
91-
58 5c 61 78 e9 7f e0 92
92-
fc 89 7c 9a 1f 17 20 d5
93-
77 0a e8 ea ad 2f a8 fc
94-
bd 08 e9 32 4a 5d de 18
95-
57
87+
04
88+
09 d4 e5 c0 ab 3d 25 fe
89+
04 8c 64 c9 da 1a 24 2c
90+
7f 19 41 7e 95 17 cd 26
91+
69 50 d7 2c 75 57 13 58
92+
5c 61 78 e9 7f e0 92 fc
93+
89 7c 9a 1f 17 20 d5 77
94+
0a e8 ea ad 2f a8 fc bd
95+
08 e9 32 4a 5d de 18 57
9696
- Public key, 0x04 prefix, then 32 bytes X and 32 bytes Y.
9797

9898

@@ -129,15 +129,15 @@ Partial Example
129129

130130
::
131131

132-
04 02 93 21 3d cf 13 88
133-
b6 1c 2a e5 cf 80 fe e6
134-
ff ff c0 49 a2 f9 fe 73
135-
65 fe 38 67 81 3c a8 12
136-
92 df 94 68 6c 6a fb 56
137-
5a c6 14 9b 15 3d 61 b3
138-
b2 87 ee 2c 7f 99 7c 14
139-
23 87 96 c1 2b 43 a3 86
140-
5a
132+
04
133+
02 93 21 3d cf 13 88 b6
134+
1c 2a e5 cf 80 fe e6 ff
135+
ff c0 49 a2 f9 fe 73 65
136+
fe 38 67 81 3c a8 12 92
137+
df 94 68 6c 6a fb 56 5a
138+
c6 14 9b 15 3d 61 b3 b2
139+
87 ee 2c 7f 99 7c 14 23
140+
87 96 c1 2b 43 a3 86 5a
141141
- Public key R
142142

143143
.. list-table:: Derived public key P (point multiply r with K):
@@ -150,15 +150,15 @@ Partial Example
150150

151151
::
152152

153-
04 0d b8 e3 ad 8c 0c d7
154-
3f a2 b3 46 71 b7 b2 47
155-
72 9b 10 11 41 57 9d 19
156-
9e 0d c0 bd 02 4e ae fd
157-
89 ca c8 f5 28 dc 90 b6
158-
68 11 ab ac 51 7d 74 97
159-
be 52 92 93 12 29 be 0b
160-
74 3e 05 03 f4 43 c3 d2
161-
96
153+
04
154+
0d b8 e3 ad 8c 0c d7 3f
155+
a2 b3 46 71 b7 b2 47 72
156+
9b 10 11 41 57 9d 19 9e
157+
0d c0 bd 02 4e ae fd 89
158+
ca c8 f5 28 dc 90 b6 68
159+
11 ab ac 51 7d 74 97 be
160+
52 92 93 12 29 be 0b 74
161+
3e 05 03 f4 43 c3 d2 96
162162
- Public key P
163163
* -
164164

@@ -230,3 +230,25 @@ Partial Example
230230
43 a6 f9 a0 d7 5a f7 ea
231231
cc 1b d9 57 14 7b f7 23
232232
- 3 blocks of 16 bytes of encrypted data.
233+
234+
.. list-table:: MAC:
235+
:header-rows: 1
236+
:widths: auto
237+
238+
* - Data
239+
- Comments
240+
* -
241+
242+
::
243+
244+
f2 52 6d 61 b4 85 1f b2
245+
34 09 86 38 26 fd 20 61
246+
65 ed c0 21 36 8c 79 46
247+
57 1c ea d6 90 46 e6 19
248+
- 32 bytes hash
249+
250+
251+
.. rubric:: Footnotes
252+
253+
.. [#f1] The pyelliptic implementation used in PyBitmessage takes unpadded data,
254+
see :obj:`.pyelliptic.Cipher.ciphering`.

0 commit comments

Comments
 (0)