wolfSSL / wolfcrypt-py

A Python wrapper that encapsulates wolfSSL's wolfCrypt API.
https://wolfssl.github.io/wolfcrypt-py
31 stars 19 forks source link

Completely refactor AES GCM #39

Closed LinuxJedi closed 2 years ago

LinuxJedi commented 2 years ago

Some bad assumptions were made during the creation of our Python AES GCM code. This is now modified to be more in-line with other libraries. This is an API breaking change on unreleased code.

This now allows for aad data to be used, varying length of authentication tags and fixes a bug for multipart.

  1. Now unified to a single class AesGcmStream()
  2. Used encrypt() and decrypt() instead of update() to avoid confusion over encryption and aad semantics
  3. final tag_bytes is configurable in the constructor
  4. set_aad() added to add the aad data
  5. aad data is cleared after first encrypt() or decrypt() call due to quirk in the C API.
  6. More tests added