Commit Graph

59 Commits (ac61190bb3fae3fa2d143443ed5c97553cc324ed)

Author SHA1 Message Date
Hubert Chathi 0e6ec3062d remove other_key checks from Python binding since it's done in C now 2020-09-24 18:56:19 +00:00
Hubert Chathi 8a958beb48 bump version info for release 2020-06-11 11:47:50 -04:00
Hubert Chathi 6753595300 release 3.1.4 2019-10-09 12:33:47 -04:00
Hubert Chathi ebd3ba6cc1 release 3.1.3 2019-06-24 17:09:41 -04:00
Matthew Hodgson ae38f2c5a0 Merge branch 'python/unicode_decode_errors' into 'master'
Python unicode decode errors when decrypting.

See merge request matrix-org/olm!4
2019-06-22 17:06:02 +00:00
Damir Jelić c4d703ac3d _compat: Make the encoding argument explicit in to_unicode_str(). 2019-06-20 12:24:08 +02:00
Damir Jelić 7538a1eccf olm: Rename the errors function argument in the decryption functions. 2019-06-20 12:16:37 +02:00
Damir Jelić fec41f9540 _compat: Remove the now unused native_str. 2019-06-19 15:07:14 +02:00
Damir Jelić 5e24c605d2 _compat: Change the to_native_str into a to_unicode_str function.
The to_native_str function was supposed to produce Unicode decoded
native strings for python2 and python3.

Upon further consideration this doesn't make much sense since under
python2 it would need to decode the bytes into a Unicode string and turn
it back into a python2 str.

The ability to use the replacement character requires us to use a
Unicode string under python2 as well.
2019-06-19 15:03:57 +02:00
Damir Jelić ba65551d5f _compat: Remove unused import. 2019-06-19 14:42:58 +02:00
Damir Jelić 2f5590bf38 olm: Allow decryption functions to define how to handle unicode decode errors.
This patch changes the decryption functions not to fail if there was an
unicode decode error while converting the decrypted bytes plaintext into
a native python string.

Characters that cannot be decoded as unicode are now replaced with the
unicode replacement character (U+FFFD).

The old behaviour of raising an UnicodeDecodeError can be achieved by
passing the "strict" error handling scheme to the decrypt function.
2019-06-18 13:50:46 +02:00
Damir Jelić e1a4e6ebf1 compat: Add a method to convert bytes to a string that handles unicode errors. 2019-06-18 13:44:22 +02:00
Hubert Chathi 769d013ef7 release 3.1.2 2019-04-30 18:25:21 -04:00
Hubert Chathi 6aafd69f8f bump version number for 3.1.1 2019-04-29 15:01:09 -04:00
Hubert Chathi bac8ca7802 prepare for 3.1.0 release 2019-04-17 17:31:01 -04:00
Hubert Chathi 0d0169c839
Merge pull request #86 from matrix-org/add_python_pk_signing
add python bindings for PK signing
2019-04-12 19:21:17 -04:00
Hubert Chathi 107adba241 isort python/olm/pk.py 2019-04-12 13:02:57 -04:00
Damir Jelić 32b99b7935 python: Add support for the long KDF MAC calculation. 2019-04-09 10:57:36 +02:00
Damir Jelić 659eb34fa4 python: Remove an unneeded and old copyright header. 2019-04-09 10:47:26 +02:00
Hubert Chathi 74e9300daf add python bindings for PK signing 2019-04-08 17:19:47 -04:00
Hubert Chathi 2a6400716c
Merge branch 'master' into poljar/python-sas 2019-04-08 15:08:17 -04:00
Damir Jelić f160d693b6 python: Add PK bindings.
This patch adds bindings to the PK part of the Olm library contained in
the pk.h header file.

Encryption, decryption as well as pickling/unpickling of the decryption
object is supported.

Signed-off-by: Damir Jelić <poljar@termina.org.uk>
2019-04-08 15:04:32 -04:00
Damir Jelić fcfa5f12a4 python: Expose the sha256() function in the utilities.
Signed-off-by: Damir Jelić <poljar@termina.org.uk>
2019-04-02 12:56:59 +02:00
Damir Jelić 446628753b python: Add Short Authentication String bindings.
This patch adds bindings to the SAS part of the Olm library contained in
the sas.h header file.

Signed-off-by: Damir Jelić <poljar@termina.org.uk>
2019-04-02 12:56:53 +02:00
Damir Jelić 45091c158d python: Turn the signature buffer into a bytearray.
This is a workaround for a bug where signature verification would
overwrite the variable holding the signature.

This only happens on python2.

Signed-off-by: Damir Jelić <poljar@termina.org.uk>
2019-01-23 17:10:44 -05:00
Hubert Chathi ff24af601a prepare release 3.0.0 2018-10-23 12:58:10 -04:00
Hubert Chathi 0ec6a65858 add more buffer clearing 2018-10-16 15:59:32 -04:00
Hubert Chathi 5ef6a844d6 overwrite buffers that may contain sensitive data
also reduce the amount of memory copying that we do
2018-10-16 00:31:56 -04:00
Hubert Chathi 357d4ff479 remove unnecessary comments about not enough random 2018-10-16 00:04:45 -04:00
Hubert Chathi 019ff702a0 add license headers to python bindings 2018-10-15 13:54:14 -04:00
Damir Jelić e3d6673371 python: Import improved python bindings.
This commit imports the python bindings from:
    https://github.com/poljar/python-olm

The bindings are imported at commit c44b145818520d69eaaa350fb95afcb846125e0f

Minor modifications were made while importing:
    - Removed travis config
    - Removed Arch Linux PKGBUILD
    - Removed the html docs, they can be rebuild by running make html in
      the docs folder
    - Slightly modified the README

The new bindings feature some improvements over the old ones:
    - Python 2 and 3 support
    - Automatic memory management
    - Automatic memory clearing before it is freed
    - Type signatures via the python typing module
    - Full test coverage
    - Properties are utilized where it makes sense (e.g. account.id)

Signed-off-by: Damir Jelić <poljar@termina.org.uk>
2018-07-18 17:44:32 -04:00
Damir Jelić 2fccf44015 python: Remove the python bindings.
Signed-off-by: Damir Jelić <poljar@termina.org.uk>
2018-07-18 17:44:32 -04:00
Wilfried Klaebe 62b576b903 Python: add binding for olm_remove_one_time_keys
Signed-off-by: Wilfried Klaebe <w+gitstuff@chaos.in-kiel.de>
2018-05-29 11:41:25 +01:00
Richard van der Hoff f8c61b8f84 Python: Make ed25519_verify take some arguments
It's not much use if everything is hardcoded.
2017-04-24 13:14:36 +01:00
Richard van der Hoff 853ea8fbc7 Merge branch 'master'
Merge master into patched branch to fix conflicts prior to merge back to master
2017-04-24 12:35:17 +01:00
Richard van der Hoff 1225de14d7 PEP8
Fix line lengths in newly-added code
2017-04-24 12:34:28 +01:00
pik a3e5beab89 Add ed25519_verify to __init__.py and add test for ed25519_verify
Signed-off-by: Alexander Maznev <alexander.maznev@gmail.com>
2017-04-24 12:29:45 +01:00
pik e632bc9e52 Add utility module to olm/python - for ed25519_verify
Signed-off-by: Alexander Maznev <alexander.maznev@gmail.com>
2017-04-24 12:29:45 +01:00
pik 51840d82dc Return python int instead of c_uint32 for InboundGroupSession.decrypt message_index
Signed-off-by: Alexander Maznev <alexander.maznev@gmail.com>
2017-04-18 19:15:51 +01:00
Richard van der Hoff ed6ebb9a4d PEP8 for python bindings
make the python code adhere to PEP8
2017-04-18 19:07:56 +01:00
J08nY 001dc1edaa Python: Switch to a more general os.urandom for randomness source
Signed-off-by: Jan Jancar <johny@neuromancer.sk>
2017-04-04 10:45:11 +01:00
Richard van der Hoff a2f0c93a93 Implement importing group session data
olm_import_inbound_group_session, which reads the format written by
olm_export_inbound_group_session to initialise a group session.
2017-01-09 17:45:46 +00:00
Richard van der Hoff 5fbeb3e29b Enable exporting inbound group session keys
A pair of functions which allow you to export the megolm keys for an inbound
group session, so that an application can save/restore them.
2017-01-06 16:41:56 +00:00
Richard van der Hoff 700596b46a Update python wrapper to run against libolm.so.2 2016-10-25 14:50:15 +01:00
Mark Haines 5a98012c0d Merge pull request #31 from matrix-org/markjh/groupmessageindex
Return the message index when decrypting group messages.
2016-10-21 09:57:42 +01:00
Mark Haines 653790eacb Return the message index when decrypting group messages.
Applications can use the index to detect replays of the same message.
2016-10-20 09:58:55 +01:00
Matthew Hodgson 38acc352a3 fix missing ctypes function signatures
These missing signatures were causing OSX to truncate 64-bit pointers
to 32-bit pointers when calling the missing methods, causing segfaults
2016-10-02 02:50:52 +01:00
Richard van der Hoff b411f07df9 InboundGroupSession.init no longer requires a separate message_index 2016-09-22 16:24:03 +01:00
Richard van der Hoff cfcee54a81 Handle non-base64 chars in pickle files 2016-09-22 15:09:40 +01:00
Mark Haines d7bc00c81d Merge pull request #23 from matrix-org/markjh/remove_message_index
Remove the messsage index from olm_init_inbound_group_session
2016-09-13 17:54:14 +01:00