updated parameters and better question asking for rsa/ecc
This commit is contained in:
30
csr.ps1
30
csr.ps1
@@ -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
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user