Skip to content

Commit

Permalink
Fix for issue rmbolger#418. Change Add-Type to native enum
Browse files Browse the repository at this point in the history
  • Loading branch information
garthmccormack committed Apr 19, 2023
1 parent 0802b4a commit 7f6c99a
Showing 1 changed file with 13 additions and 17 deletions.
30 changes: 13 additions & 17 deletions Posh-ACME/Public/Revoke-PACertificate.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ function Revoke-PACertificate {
[string]$CertFile,
[Parameter(ParameterSetName='CertFile',ValueFromPipelineByPropertyName)]
[string]$KeyFile,
[PoshACME.RevocationReasons]$Reason,
[RevocationReasons]$Reason,
[switch]$Force
)

Expand Down Expand Up @@ -171,21 +171,17 @@ function Revoke-PACertificate {
# that ACME supports.
# https://datatracker.ietf.org/doc/html/rfc8555#section-7.6
# https://datatracker.ietf.org/doc/html/rfc5280#section-5.3.1
if (-not ([System.Management.Automation.PSTypeName]'PoshACME.RevocationReasons').Type)
if (-not ([System.Management.Automation.PSTypeName]'RevocationReasons').Type)
{
Add-Type @"
namespace PoshACME {
public enum RevocationReasons {
keyCompromise = 1,
cACompromise = 2,
affiliationChanged = 3,
superseded = 4,
cessationOfOperation = 5,
certificateHold = 6,
removeFromCRL = 8,
privilegeWithdrawn = 9,
aACompromise = 10
}
}
"@
enum RevocationReasons {
keyCompromise = 1
cACompromise = 2
affiliationChanged = 3
superseded = 4
cessationOfOperation = 5
certificateHold = 6
removeFromCRL = 8
privilegeWithdrawn = 9
aACompromise = 10
}
}

0 comments on commit 7f6c99a

Please sign in to comment.