Python Forum
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Load X509 Certificate
#3
Thank you Buran for your help. I am new to python and unable to find proper api for getting PFX cert from cert store with specific thumbprint and also am looking for constructing cert object from pfx cert data (base64). Here is the power shell script to do the same (get cert data from key vault and construct c in memory cert object)


$returnval = Get-AzureKeyVaultSecret -VaultName $VaultName -SecretName $EncryptionCertName
$kvSecretBytes = [System.Convert]::FromBase64String($returnval.SecretValueText)
$certCollection = New-Object System.Security.Cryptography.X509Certificates.X509Certificate2Collection
$certCollection.Import($kvSecretBytes,$null,[System.Security.Cryptography.X509Certificates.X509KeyStorageFlags]::Exportable)
$protectedCertificateBytes = $certCollection.Export([System.Security.Cryptography.X509Certificates.X509ContentType]::Pkcs12, $null)
$cert = New-Object System.Security.Cryptography.X509Certificates.X509Certificate2
$cert.Import($protectedCertificateBytes)

basically what the script does is, get cert data (base64) from key vault (which is cert store in Azure where pfx file is stored) and convert it to byte array and then construct X509Certificate2 object from byte array.

Can you please help me on how can I achieve this in Python.

Thanks,
Praveen V
Reply


Messages In This Thread
Load X509 Certificate - by paul198204 - May-09-2018, 01:00 AM
RE: Load X509 Certificate - by buran - May-09-2018, 08:59 AM
RE: Load X509 Certificate - by paul198204 - May-09-2018, 07:35 PM

Possibly Related Threads…
Thread Author Replies Views Last Post
  Impact of SSL certificate amitchauhan 0 1,460 Jan-06-2020, 10:02 AM
Last Post: amitchauhan

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020