18 lines
754 B
PowerShell
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
|