updated parameters and better question asking for rsa/ecc

This commit is contained in:
2022-09-04 10:44:06 -04:00
parent 1f3c3b6999
commit 164bb860af

30
csr.ps1
View File

@@ -1,13 +1,33 @@
param(
$rsa,
[switch]$rsa,
[switch]$ecc,
$hostnames
)
if (-not $PSBoundParameters.ContainsKey('rsa')) {
$test = read-host "Do you want a RSA (r) or EEC (e) cert? (e/r)"
function Get-RSAorECC {
[cmdletbinding()]
param(
[Parameter(Mandatory)]
[string]$title,
[Parameter(Mandatory)]
[string]$question
)
if ($test -eq "r") {
$rsa = $True
# list of choices for the user
$choices = '&RSA', '&ECC'
# prompt the user to confirm
$decision = $Host.UI.PromptForChoice($title, $question, $choices, 1)
# return value if 0, user entered r for RSA
if ($decision -eq 0) {
return "RSA"
} else {
return "ECC"
}
}
if (-not $rsa -and -not $ecc) {
if ($(Get-RSAorECC) -eq "RSA") {
$rsa = $true
}
}