open-quantum-safe / liboqs-python

Python 3 bindings for liboqs
https://openquantumsafe.org/
MIT License
108 stars 39 forks source link

Refactor liboqs-python classes / API changes #8

Closed truth-quark closed 5 years ago

truth-quark commented 5 years ago

As per the weekly meeting, here is a PR for discussion of the code changes pushed yesterday.

The tasks & discussion points include:

dstebila commented 5 years ago
  • Douglas: does the OQS_[KEM|SIG] represent an instance of an alg, or a general mechanism?
  • Douglas: methods, secret_key as member vs method arg

I think I'd prefer OQS_[KEM|SIG] to represent the algorithm, but not contain the keys. In other words, keypair always returns both a secret key and a public key, and then decapsulate takes the secret key as input. And one could use the same OQS_KEM object to generate many keypairs and encapsulate/decapsulate with many different keypairs.

christianpaquin commented 5 years ago

I create these classes with more of a object-oriented design, to simplify the job of the developer (same as in the C# wrapper). The developer might never need to export the KEM private key for a PQ exchange, so keeping it in the class abstracts this complexity away. The key can is available through its own variable if needed. Otherwise, we're forcing all devs to implement similar classes about our wrapper to hide the complexity to their own app.

dstebila commented 5 years ago

Ready to merge or still work to do?

christianpaquin commented 5 years ago

I tested the latest commits on Linux and Windows; works for me.

truth-quark commented 5 years ago

Ready to merge or still work to do?

If folks are happy with the class refactoring etc, I'd say merge & let others try it out.

There's several open ended questions in the ticket. but I can copy them to the wiki & convert to tickets as needed. It's probably better to have Travis working before making more structural changes.