Skip to content

Commit

Permalink
Merge pull request #92 from PKISharp/net-core-31-fix
Browse files Browse the repository at this point in the history
Use Enum instead of String
  • Loading branch information
glatzert authored Jul 24, 2020
2 parents 14d187e + 3a6ebe7 commit c6315fa
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 11 deletions.
4 changes: 2 additions & 2 deletions ACME-PS/ACME-PS.psd1
Original file line number Diff line number Diff line change
@@ -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")
Expand Down Expand Up @@ -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'
Expand Down
2 changes: 1 addition & 1 deletion ACME-PS/functions/Certificate/Export-Certificate.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -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");
Expand Down
4 changes: 2 additions & 2 deletions dist/ACME-PS/ACME-PS.psd1
Original file line number Diff line number Diff line change
@@ -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")
Expand Down Expand Up @@ -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'
Expand Down
17 changes: 11 additions & 6 deletions dist/ACME-PS/ACME-PS.psm1
Original file line number Diff line number Diff line change
Expand Up @@ -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");
Expand Down Expand Up @@ -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.
Expand Down Expand Up @@ -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) {
Expand All @@ -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;

Expand Down

0 comments on commit c6315fa

Please sign in to comment.