Install/OnPrem/Import-ClientCert.ps1

Import-Module "$PSScriptRoot\..\..\Common\SSL\SSL-Module.psm1" -Force
$ErrorActionPreference = "Stop"

$clientCert = $global:Configuration.ssl.custom.clientCert
if ([string]::IsNullOrEmpty($clientCert)) {
    $password = $global:Configuration.ssl.auto.pfxPassword
    $certName = BuildSitecoreClientCertName -Prefix $global:Configuration.prefix

    CleanCertStore -CertName $certName -Store "LocalMachine"
    CleanCertStore -CertName $certName -Store "CurrentUser"

    ImportCert -PfxName "SitecoreClientSSLCertificate_SAF.pfx" -Password $password
}
else {
    Write-Warning "It seems that you are using a custom SSL client certificate. Skipping import..." 
    Start-Sleep -s 5
}