How can we retrieve public key from private key ( protected with passphrase ) using python's Cryptography library?
How can we retrieve public key from private key ( protected with passphrase ) using python's Cryptography library?
I want to use python's Cryptography library to get public key from private key(which could be protected by passphrase also). How can I do that similar to Python's CryptoDome library ?
public_key()
James K, can you point me to the link? I couldn't find it.
– Bharat MV
2 days ago
Here it is for RSA. And here it is for elliptic curves, and here for diffie-hellman. Each type of private key has a method called
public_key()
.– James K Polk
2 days ago
public_key()
@JamesKPolk Using this API, I am not getting whatever ssh-keygen -y -f <key_file> returns as public key. Apparently there can be infinite public keys for a given private key and also the public key it is generating starts with BEGIN PUBLIC KEY. The above ssh-keygen command returns public key like: ssh-rsa ABCD . Can I get public key whatever the above ssh-keygen command returns? The way I am retrieving public key using the Cryptography library is: pastebin.com/UHjKbC0Q
– Bharat MV
23 hours ago
I googled and looks like I have to use serialization.Encoding.OpenSSH and serialization.PublicFormat.OpenSSH . Is that right?
– Bharat MV
23 hours ago
By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.
By using the
public_key()
method.– James K Polk
Jun 29 at 22:44