Install/OnPrem/Solr/New-RootCert.ps1

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

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

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