Last active
September 5, 2019 05:14
-
-
Save Brycey92/383c63079b5b9ca5e3cdaaa46be54b96 to your computer and use it in GitHub Desktop.
Meant to be used with the Certify the Web certificate manager as the post-request script. Fill in the CAPITALIZED fields before using.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
param($result) | |
$tempCertPath = "temp.pem" | |
$certPath = "PATH TO SAVE A MASTER COPY OF YOUR ENCRYPTED CERTIFICATE.pfx" | |
$destinationPaths = @() | |
#You can repeat the line below as many times as you need, once for each destination certificate path | |
$destinationPaths += "PATH TO COPY YOUR CERTIFICATE TO.pfx" | |
$pass = "YOUR PASSWORD" | |
$alias = "YOUR CERTIFICATE ALIAS" | |
if ($result.IsSuccess) { | |
openssl pkcs12 -in $result.ManagedItem.CertificatePath -out $tempCertPath -passin `"pass:`" -nodes | |
openssl pkcs12 -export -in $tempCertPath -out $certPath -passout pass:$pass -name $alias | |
Remove-Item $tempCertPath | |
foreach($destinationPath in $destinationPaths) { | |
Copy-Item -Path $certPath -Destination $destinationPath -Force | |
} | |
Write-Output "Deployment complete." | |
} else { | |
Write-Error "Deployment failed." | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment