Install/OnPrem/New-RootCert.ps1

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

$rootCertName = BuildSitecoreRootCertName -Prefix $global:Configuration.prefix
$exportPath = Get-Location
$password = $global:Configuration.ssl.auto.pfxPassword

$certDestPath = Join-Path -Path $exportPath -ChildPath "SitecoreRootSSLCertificate_SAF.pfx"
if (Test-Path $certDestPath) {
    Write-Warning "It seems that you alredy have SitecoreRootSSLCertificate_SAF.pfx SSL certificate. Skipping creation..."
    Start-Sleep -s 5
}
else {
    GenerateRootCert -RootCertName $rootCertName
    ExportCert -CertName $rootCertName -PfxName "SitecoreRootSSLCertificate_SAF.pfx" -ExportPath $exportPath -Password $password
}