python3-olm 3.2.18__cp313-cp313-win_amd64.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- _libolm.pyd +0 -0
- olm/__init__.py +48 -0
- olm/_compat.py +67 -0
- olm/_finalize.py +64 -0
- olm/account.py +321 -0
- olm/group_session.py +531 -0
- olm/pk.py +453 -0
- olm/py.typed +0 -0
- olm/sas.py +276 -0
- olm/session.py +510 -0
- olm/utility.py +149 -0
- python3_olm-3.2.18.dist-info/METADATA +186 -0
- python3_olm-3.2.18.dist-info/RECORD +15 -0
- python3_olm-3.2.18.dist-info/WHEEL +5 -0
- python3_olm-3.2.18.dist-info/top_level.txt +2 -0
|
@@ -0,0 +1,186 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: python3-olm
|
|
3
|
+
Version: 3.2.18
|
|
4
|
+
Summary: python CFFI bindings for the olm cryptographic ratchet library
|
|
5
|
+
Author-email: Damir Jelić <poljar@termina.org.uk>
|
|
6
|
+
License: Apache-2.0
|
|
7
|
+
Project-URL: homepage, https://gitlab.matrix.org/matrix-org/olm/-/tree/master/python
|
|
8
|
+
Classifier: License :: OSI Approved :: Apache Software License
|
|
9
|
+
Classifier: Topic :: Communications
|
|
10
|
+
Requires-Python: <4.0.0,>=3.9
|
|
11
|
+
Description-Content-Type: text/markdown
|
|
12
|
+
Requires-Dist: cffi>=1.0.0
|
|
13
|
+
|
|
14
|
+
python-olm
|
|
15
|
+
==========
|
|
16
|
+
|
|
17
|
+
Python bindings for Olm.
|
|
18
|
+
|
|
19
|
+
The specification of the Olm cryptographic ratchet which is used for peer to
|
|
20
|
+
peer sessions of this library can be found [here][4].
|
|
21
|
+
|
|
22
|
+
The specification of the Megolm cryptographic ratchet which is used for group
|
|
23
|
+
sessions of this library can be found [here][5].
|
|
24
|
+
|
|
25
|
+
An example of the implementation of the Olm and Megolm cryptographic protocol
|
|
26
|
+
can be found in the Matrix protocol for which the implementation guide can be
|
|
27
|
+
found [here][6].
|
|
28
|
+
|
|
29
|
+
The full API reference can be found [here][7].
|
|
30
|
+
|
|
31
|
+
# Installation instructions
|
|
32
|
+
|
|
33
|
+
To install from the source package, you will need:
|
|
34
|
+
|
|
35
|
+
- cmake (recommended) or GNU make
|
|
36
|
+
- a C/C++ compiler
|
|
37
|
+
|
|
38
|
+
You can then run `pip install python-olm`.
|
|
39
|
+
|
|
40
|
+
This should work in UNIX-like environments, including macOS, and may work in
|
|
41
|
+
other environments too, but is known to not work yet in Windows.
|
|
42
|
+
|
|
43
|
+
# Accounts
|
|
44
|
+
|
|
45
|
+
Accounts create and hold the central identity of the Olm protocol, they consist of a fingerprint and identity
|
|
46
|
+
key pair. They also produce one time keys that are used to start peer to peer
|
|
47
|
+
encrypted communication channels.
|
|
48
|
+
|
|
49
|
+
## Account Creation
|
|
50
|
+
|
|
51
|
+
A new account is created with the Account class, it creates a new Olm key pair.
|
|
52
|
+
The public parts of the key pair are available using the identity_keys property
|
|
53
|
+
of the class.
|
|
54
|
+
|
|
55
|
+
```python
|
|
56
|
+
>>> alice = Account()
|
|
57
|
+
>>> alice.identity_keys
|
|
58
|
+
{'curve25519': '2PytGagXercwHjzQETLcMa3JOsaU2qkPIESaqoi59zE',
|
|
59
|
+
'ed25519': 'HHpOuFYdHwoa54GxSttz9YmaTmbuVU3js92UTUjYJgM'}
|
|
60
|
+
```
|
|
61
|
+
|
|
62
|
+
|
|
63
|
+
## One Time keys
|
|
64
|
+
|
|
65
|
+
One time keys need to be generated before people can start an encrypted peer to
|
|
66
|
+
peer channel to an account.
|
|
67
|
+
|
|
68
|
+
```python
|
|
69
|
+
>>> alice.generate_one_time_keys(1)
|
|
70
|
+
>>> alice.one_time_keys
|
|
71
|
+
{'curve25519': {'AAAAAQ': 'KiHoW6CIy905UC4V1Frmwr3VW8bTWkBL4uWtWFFllxM'}}
|
|
72
|
+
```
|
|
73
|
+
|
|
74
|
+
After the one time keys are published they should be marked as such so they
|
|
75
|
+
aren't reused.
|
|
76
|
+
|
|
77
|
+
```python
|
|
78
|
+
>>> alice.mark_keys_as_published()
|
|
79
|
+
>>> alice.one_time_keys
|
|
80
|
+
{'curve25519': {}}
|
|
81
|
+
```
|
|
82
|
+
|
|
83
|
+
## Pickling
|
|
84
|
+
|
|
85
|
+
Accounts should be stored for later reuse, storing an account is done with the
|
|
86
|
+
pickle method while the restoring step is done with the from_pickle class
|
|
87
|
+
method.
|
|
88
|
+
|
|
89
|
+
```python
|
|
90
|
+
>>> pickle = alice.pickle()
|
|
91
|
+
>>> restored = Account.from_pickle(pickle)
|
|
92
|
+
```
|
|
93
|
+
|
|
94
|
+
# Sessions
|
|
95
|
+
|
|
96
|
+
Sessions are used to create an encrypted peer to peer communication channel
|
|
97
|
+
between two accounts.
|
|
98
|
+
|
|
99
|
+
## Session Creation
|
|
100
|
+
```python
|
|
101
|
+
>>> alice = Account()
|
|
102
|
+
>>> bob = Account()
|
|
103
|
+
>>> bob.generate_one_time_keys(1)
|
|
104
|
+
>>> id_key = bob.identity_keys["curve25519"]
|
|
105
|
+
>>> one_time = list(bob.one_time_keys["curve25519"].values())[0]
|
|
106
|
+
>>> alice_session = OutboundSession(alice, id_key, one_time)
|
|
107
|
+
```
|
|
108
|
+
|
|
109
|
+
## Encryption
|
|
110
|
+
|
|
111
|
+
After an outbound session is created an encrypted message can be exchanged:
|
|
112
|
+
|
|
113
|
+
```python
|
|
114
|
+
>>> message = alice_session.encrypt("It's a secret to everybody")
|
|
115
|
+
>>> message.ciphertext
|
|
116
|
+
'AwogkL7RoakT9gnjcZMra+y39WXKRmnxBPEaEp6OSueIA0cSIJxGpBoP8YZ+CGweXQ10LujbXMgK88
|
|
117
|
+
xG/JZMQJ5ulK9ZGiC8TYrezNYr3qyIBLlecXr/9wnegvJaSFDmWDVOcf4XfyI/AwogqIZfAklRXGC5b
|
|
118
|
+
ZJcZxVxQGgJ8Dz4OQII8k0Dp8msUXwQACIQvagY1dO55Qvnk5PZ2GF+wdKnvj6Zxl2g'
|
|
119
|
+
>>> message.message_type
|
|
120
|
+
0
|
|
121
|
+
```
|
|
122
|
+
|
|
123
|
+
After the message is transfered, bob can create an InboundSession to decrypt the
|
|
124
|
+
message.
|
|
125
|
+
|
|
126
|
+
```python
|
|
127
|
+
>>> bob_session = InboundSession(bob, message)
|
|
128
|
+
>>> bob_session.decrypt(message)
|
|
129
|
+
"It's a secret to everybody"
|
|
130
|
+
```
|
|
131
|
+
|
|
132
|
+
## Pickling
|
|
133
|
+
|
|
134
|
+
Sessions like accounts can be stored for later use the API is the same as for
|
|
135
|
+
accounts.
|
|
136
|
+
|
|
137
|
+
```python
|
|
138
|
+
>>> pickle = session.pickle()
|
|
139
|
+
>>> restored = Session.from_pickle(pickle)
|
|
140
|
+
```
|
|
141
|
+
|
|
142
|
+
# Group Sessions
|
|
143
|
+
|
|
144
|
+
Group Sessions are used to create a one-to-many encrypted communication channel.
|
|
145
|
+
The group session key needs to be shared with all participants that should be able
|
|
146
|
+
to decrypt the group messages. Another thing to notice is that, since the group
|
|
147
|
+
session key is ratcheted every time a message is encrypted, the session key should
|
|
148
|
+
be shared before any messages are encrypted.
|
|
149
|
+
|
|
150
|
+
## Group Session Creation
|
|
151
|
+
|
|
152
|
+
Group sessions aren't bound to an account like peer-to-peer sessions so their
|
|
153
|
+
creation is straightforward.
|
|
154
|
+
|
|
155
|
+
```python
|
|
156
|
+
>>> alice_group = OutboundGroupSession()
|
|
157
|
+
>>> bob_inbound_group = InboundGroupSession(alice_group.session_key)
|
|
158
|
+
```
|
|
159
|
+
|
|
160
|
+
## Group Encryption
|
|
161
|
+
|
|
162
|
+
Group encryption is pretty simple. The important part is to share the session
|
|
163
|
+
key with all participants over a secure channel (e.g. peer-to-peer Olm
|
|
164
|
+
sessions).
|
|
165
|
+
|
|
166
|
+
```python
|
|
167
|
+
>>> message = alice_group.encrypt("It's a secret to everybody")
|
|
168
|
+
>>> bob_inbound_group.decrypt(message)
|
|
169
|
+
("It's a secret to everybody", 0)
|
|
170
|
+
```
|
|
171
|
+
|
|
172
|
+
## Pickling
|
|
173
|
+
|
|
174
|
+
Pickling works the same way as for peer-to-peer Olm sessions.
|
|
175
|
+
|
|
176
|
+
```python
|
|
177
|
+
>>> pickle = session.pickle()
|
|
178
|
+
>>> restored = InboundGroupSession.from_pickle(pickle)
|
|
179
|
+
```
|
|
180
|
+
[1]: https://git.matrix.org/git/olm/about/
|
|
181
|
+
[2]: https://git.matrix.org/git/olm/tree/python?id=f8c61b8f8432d0b0b38d57f513c5048fb42f22ab
|
|
182
|
+
[3]: https://cffi.readthedocs.io/en/latest/
|
|
183
|
+
[4]: https://git.matrix.org/git/olm/about/docs/olm.rst
|
|
184
|
+
[5]: https://git.matrix.org/git/olm/about/docs/megolm.rst
|
|
185
|
+
[6]: https://matrix.org/docs/guides/end-to-end-encryption-implementation-guide
|
|
186
|
+
[7]: https://poljar.github.io/python-olm/html/index.html
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
_libolm.pyd,sha256=324poEL0fw8v1qnHTiAPUJBS6iKxtHEngnoubIvGcLE,287744
|
|
2
|
+
olm/__init__.py,sha256=da1JTzBIEMe2CVqvmy4mXjjIGlzQy7PcPW_IRk3S0s8,1489
|
|
3
|
+
olm/_compat.py,sha256=jfSCAA_RWK5xJ9wv99NZ-zsItcnGqJnZPsFrOUP_jXA,2410
|
|
4
|
+
olm/_finalize.py,sha256=QAHFUr5GQoCRc6nNvV93Rm3bVKv-wEKRCrUExdAvUu0,2277
|
|
5
|
+
olm/account.py,sha256=BxfvJei-QOSHiLZUUDCXlLL4_BcOvKgy6U44_7vGgYU,12194
|
|
6
|
+
olm/group_session.py,sha256=buKNmbLvM0ih0gFbbF6zFCIl1n_khxP859MaKY78Xbc,19477
|
|
7
|
+
olm/pk.py,sha256=WaXNM67PiBm6RdyXJMbeRD3K4eVNhBTATaqxi6ZjpE0,15036
|
|
8
|
+
olm/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
9
|
+
olm/sas.py,sha256=ScRwsDywgZyZGj4uYdjS0lqGKvhut7-02k0wpx-kSvU,8730
|
|
10
|
+
olm/session.py,sha256=xoHBT9ad2wDmcwXMIJQi1YMUOGuRDthjYa5WXMNPOKM,19697
|
|
11
|
+
olm/utility.py,sha256=VkGjTy_Pas3JQ2YxSF6D6zlEtu5TVXWIAnoGPUpl7p8,4548
|
|
12
|
+
python3_olm-3.2.18.dist-info/METADATA,sha256=h1ngYuO7UAjhXo_pLo6efeHH16ev8DDiI9_eaPh3w4g,5694
|
|
13
|
+
python3_olm-3.2.18.dist-info/WHEEL,sha256=x5Wpw_tLx5PQKiWdxpqvs0e7Sg-SO0mTWdEADYDGPGA,101
|
|
14
|
+
python3_olm-3.2.18.dist-info/top_level.txt,sha256=sogtEKKsrbWWMXwOlv_q_6mSjqy0gOFb2UEUNpRDRN0,12
|
|
15
|
+
python3_olm-3.2.18.dist-info/RECORD,,
|