mc2-project / mc2

A Platform for Secure Analytics and Machine Learning
Apache License 2.0
299 stars 45 forks source link

Generate public key in `generate_keypair()` #147

Open chester-leung opened 3 years ago

chester-leung commented 3 years ago

Currently, generate_keypair() outputs a private key and a certificate. We should modify this function to also generate and output a public key.

lvntky commented 3 years ago

hi @chester-leung i'm on to this. should i create a new variable public_key = _LIB.get_public_key() and change the private key with this variable?

chester-leung commented 3 years ago

hi @lvntky, for this you'll have to look at this function. As you can see we generate a private key and a certificate using the Python OpenSSL crypto library.

To get the public key as well you'll have to make another OpenSSL crypto call -- likely this one to dump the public key. We already dump the private key here -- you'll likely just have to do something similar to dump the public key.

Would be great if you can also test what you implement to ensure that the public and private key work together as a pair. Thank you!

lvntky commented 3 years ago

okay @chester-leung thank you for this great information. I'm on to it .