I'm working in a personal project where I need to read a p12
cert in Python3. For now, i need to use openssl_pkey_get_private
and openssl_pkey_get_details
equivalents from php in Python3, but i didn't found a way to do it
I have searched the web for the equivalent for python without a look.
The PHP code that i need to convert to python is as follows:
$complem = openssl_pkey_get_details(openssl_pkey_get_private($this->privateKey));
$this->Modulus = base64_encode($complem['rsa']['n']);
$this->Exponent = base64_encode($complem['rsa']['e']);
For openssl_pkey_get_private
I wrote this code:
def openssl_pkey_get_private(private_key):
detailed_key = RSA.importKey(private_key)
return detailed_key
Above code gives an array with a
, e
, n
, etc. But for openssl_pkey_get_details
I have no idea about what to do.