mc2 icon indicating copy to clipboard operation
mc2 copied to clipboard

Generate public key in `generate_keypair()`

Open chester-leung opened this issue 3 years ago • 3 comments

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

chester-leung avatar Jun 14 '21 16:06 chester-leung

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?

lvntky avatar Jun 16 '21 11:06 lvntky

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!

chester-leung avatar Jun 16 '21 17:06 chester-leung

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

lvntky avatar Jun 16 '21 19:06 lvntky