PowerShell script that imports a .pfx certificate file. Useful to do before building the solution on a build server.
param($PfxFilePath, $Password) | |
$absolutePfxFilePath = Resolve-Path -Path $PfxFilePath | |
Write-Output "Importing store certificate '$absolutePfxFilePath'..." | |
Add-Type -AssemblyName System.Security | |
$cert = New-Object System.Security.Cryptography.X509Certificates.X509Certificate2 | |
$cert.Import($absolutePfxFilePath, $Password, [System.Security.Cryptography.X509Certificates.X509KeyStorageFlags]"PersistKeySet") | |
$store = new-object system.security.cryptography.X509Certificates.X509Store -argumentlist "MY", CurrentUser | |
$store.Open([System.Security.Cryptography.X509Certificates.OpenFlags]::"ReadWrite") | |
$store.Add($cert) | |
$store.Close() |
This comment has been minimized.
This comment has been minimized.
|
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
This comment has been minimized.
liushuanggang commentedAug 23, 2019
@deadlydog, What the value should be set for "MY"?