I did a Google
search but I didn't find anything that would help me on that.I'm trying to authenticate my app
in Microsoft Azure
, so I created some self signed certificates
. They give a tutorial of how to parse the crt
however it's in PowerShell
. I use only Ubuntu
/ OS X
. Here's the code:
$cer = New-Object System.Security.Cryptography.X509Certificates.X509Certificate2
$cer.Import("mycer.cer")
$bin = $cer.GetRawCertData()
$base64Value = [System.Convert]::ToBase64String($bin)
$bin = $cer.GetCertHash()
$base64Thumbprint = [System.Convert]::ToBase64String($bin)
$keyid = [System.Guid]::NewGuid().ToString()
How would I go about writing the same code in Python
? I have the .crt
, .key
, .csr
, .pass.key
and pkcs8_key
files.
Update:
I want to extract the keyId
and customKeyIdentifier
from the certificates.