Files
powershell/import_export_starew.ps1
2023-03-09 09:06:25 +01:00

18 lines
754 B
PowerShell

#not Tested
$certificate = New-Object System.Security.Cryptography.X509Certificates.X509Certificate2("C:\Users\a.warme\Downloads\star.east-west.dk-2024-02-05\star.east-west.dk-2024-02-05.pfx","thales")
$store = New-Object System.Security.Cryptography.X509Certificates.X509Store("My", "LocalMachine")
$store.Open("ReadWrite")
$store.Add($certificate)
$store.Close()
$CertStore = New-Object System.Security.Cryptography.X509Certificates.X509Store("My", "LocalMachine")
$CertStore.Open("ReadOnly")
$Certificate = $CertStore.Certificates | Where-Object {$_.Subject -eq "CN=star.east-west.dk"}
$Base64 = [System.Convert]::ToBase64String($Certificate.Export([System.Security.Cryptography.X509Certificates.X509ContentType]::Cert))
Write-Output $Base64