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(
|
param(
|
||||||
$rsa,
|
[switch]$rsa,
|
||||||
|
[switch]$ecc,
|
||||||
$hostnames
|
$hostnames
|
||||||
)
|
)
|
||||||
|
|
||||||
if (-not $PSBoundParameters.ContainsKey('rsa')) {
|
function Get-RSAorECC {
|
||||||
$test = read-host "Do you want a RSA (r) or EEC (e) cert? (e/r)"
|
[cmdletbinding()]
|
||||||
|
param(
|
||||||
|
[Parameter(Mandatory)]
|
||||||
|
[string]$title,
|
||||||
|
[Parameter(Mandatory)]
|
||||||
|
[string]$question
|
||||||
|
)
|
||||||
|
|
||||||
if ($test -eq "r") {
|
# list of choices for the user
|
||||||
$rsa = $True
|
$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