diff --git a/ACME-PS/ACME-PS.psd1 b/ACME-PS/ACME-PS.psd1 index 8c90576..3257669 100644 --- a/ACME-PS/ACME-PS.psd1 +++ b/ACME-PS/ACME-PS.psd1 @@ -1,6 +1,6 @@ @{ RootModule = 'ACME-PS.psm1' - ModuleVersion = '1.2.3' + ModuleVersion = '1.2.4' GUID = '2DBF7E3F-F830-403A-9300-78A11C7CD00C' CompatiblePSEditions = @("Core", "Desktop") @@ -79,7 +79,7 @@ ProjectUri = 'https://github.com/PKISharp/ACME-PS' # An icon representing this module. - Icon = './ACME-PS.png' + IconUri = 'https://github.com/PKISharp/ACME-PS/raw/master/ACME-PS/ACME-PS.png' # ReleaseNotes of this module ReleaseNotes = 'Please see the release notes from the release distribution page: https://github.com/PKISharp/ACME-PS/releases' diff --git a/ACME-PS/functions/Certificate/Export-Certificate.ps1 b/ACME-PS/functions/Certificate/Export-Certificate.ps1 index e2a0b94..f5c3558 100644 --- a/ACME-PS/functions/Certificate/Export-Certificate.ps1 +++ b/ACME-PS/functions/Certificate/Export-Certificate.ps1 @@ -119,7 +119,7 @@ function Export-Certificate { $pemString = [System.Text.Encoding]::UTF8.GetString($certificate); $certificates = [System.Collections.ArrayList]::new(); - foreach($pem in $pemString.Split(@($certBoundary), "RemoveEmptyEntries")) { + foreach($pem in $pemString.Split(@($certBoundary), [System.StringSplitOptions]::RemoveEmptyEntries)) { if(-not $pem -or -not $pem.Trim()) { continue; } $certBytes = [System.Text.Encoding]::UTF8.GetBytes($pem.Trim() + "`n$certBoundary"); diff --git a/dist/ACME-PS/ACME-PS.psd1 b/dist/ACME-PS/ACME-PS.psd1 index 8c90576..3257669 100644 --- a/dist/ACME-PS/ACME-PS.psd1 +++ b/dist/ACME-PS/ACME-PS.psd1 @@ -1,6 +1,6 @@ @{ RootModule = 'ACME-PS.psm1' - ModuleVersion = '1.2.3' + ModuleVersion = '1.2.4' GUID = '2DBF7E3F-F830-403A-9300-78A11C7CD00C' CompatiblePSEditions = @("Core", "Desktop") @@ -79,7 +79,7 @@ ProjectUri = 'https://github.com/PKISharp/ACME-PS' # An icon representing this module. - Icon = './ACME-PS.png' + IconUri = 'https://github.com/PKISharp/ACME-PS/raw/master/ACME-PS/ACME-PS.png' # ReleaseNotes of this module ReleaseNotes = 'Please see the release notes from the release distribution page: https://github.com/PKISharp/ACME-PS/releases' diff --git a/dist/ACME-PS/ACME-PS.psm1 b/dist/ACME-PS/ACME-PS.psm1 index d981735..018366b 100644 --- a/dist/ACME-PS/ACME-PS.psm1 +++ b/dist/ACME-PS/ACME-PS.psm1 @@ -2165,7 +2165,7 @@ function Export-Certificate { $pemString = [System.Text.Encoding]::UTF8.GetString($certificate); $certificates = [System.Collections.ArrayList]::new(); - foreach($pem in $pemString.Split(@($certBoundary), "RemoveEmptyEntries")) { + foreach($pem in $pemString.Split(@($certBoundary), [System.StringSplitOptions]::RemoveEmptyEntries)) { if(-not $pem -or -not $pem.Trim()) { continue; } $certBytes = [System.Text.Encoding]::UTF8.GetBytes($pem.Trim() + "`n$certBoundary"); @@ -2699,6 +2699,7 @@ function Complete-Order { .PARAMETER GenerateCertificateKey If present, the cmdlet will automatically create a certificate key and store it with the order object. + Should the order already have an associated key, it will be used. .PARAMETER PassThru Forces the order to be returned to the pipeline. @@ -2745,12 +2746,16 @@ function Complete-Order { $ErrorActionPreference = 'Stop'; if($GenerateCertificateKey) { - $SaveCertificateKey = $true; - $CertificateKey = New-CertificateKey -SkipKeyExport -WarningAction 'SilentlyContinue' + $CertificateKey = $State.GetOrderCertificateKey($Order); + + if($null -eq $CertificateKey) { + $SaveCertificateKey = $true; + $CertificateKey = New-CertificateKey -SkipKeyExport -WarningAction 'SilentlyContinue'; + } } if($null -eq $CertificateKey) { - throw "You need to provide a certificate key or enable automatic generation." + throw "You need to provide a certificate key or enable automatic generation."; } if($SaveCertificateKey) { @@ -2761,11 +2766,11 @@ function Complete-Order { if($Order.CSROptions -and -not [string]::IsNullOrWhiteSpace($Order.CSROptions.DistinguishedName)) { $certDN = $Order.CSROptions.DistinguishedName; } else { - $certDN = "CN=$($Order.Identifiers[0].Value)" + $certDN = "CN=$($Order.Identifiers[0].Value)"; } $csr = $CertificateKey.GenerateCsr($dnsNames, $certDN); - $payload = @{ "csr"= (ConvertTo-UrlBase64 -InputBytes $csr) } + $payload = @{ "csr"= (ConvertTo-UrlBase64 -InputBytes $csr) }; $requestUrl = $Order.FinalizeUrl;