Adds exceptions in case source Cert file is missing as argument or invalid

This commit is contained in:
Christian Stein 2020-03-26 07:33:28 +01:00
parent c6dc082081
commit 30a7d6f257

View file

@ -6,6 +6,14 @@ function ConvertTo-IcingaX509Certificate()
[switch]$Force = $FALSE [switch]$Force = $FALSE
); );
if ([string]::IsNullOrEmpty($CertFile)) {
throw 'Please specify a valid path to an existing certificate (.cer, .pem, .cert)';
}
if ((Test-Path $CertFile) -eq $FALSE) {
throw 'The provided path to your certificate was not valid';
}
# Use an empty password for converted certificates # Use an empty password for converted certificates
$Password = $null; $Password = $null;
# Use a target file to specify if we use temp files or not # Use a target file to specify if we use temp files or not