Python Forum
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Load X509 Certificate
#1
Hi,

I am looking for some help to find out code snippet for loading the SSL certificate from system store. Please help me here.

Thanks,
Paul
Reply
#2
https://bugs.python.org/issue28547
If you can't explain it to a six year old, you don't understand it yourself, Albert Einstein
How to Ask Questions The Smart Way: link and another link
Create MCV example
Debug small programs

Reply
#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


Possibly Related Threads…
Thread Author Replies Views Last Post
  Impact of SSL certificate amitchauhan 0 1,436 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