Commit Graph

9 Commits (afb3d403e102a6c8dbd222278ad9b96de7606d00)

Author SHA1 Message Date
Hubert Chathi afb3d403e1 actually remove dependency on future 2023-04-26 10:00:34 -04:00
Damir Jelić 7538a1eccf olm: Rename the errors function argument in the decryption functions. 2019-06-20 12:16:37 +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ć 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
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