Bad enum error adding OIDs

Apr 3, 2014 at 10:20 PM
Hi

I am trying to add OIDs on a stand-alone offline root CA. I am getting an error about a bad enum:

PS C:\Users\Administrator> register-objectidentifier -friendlyname HighHardAdmin -value 1.2.826.0.1310.30.1.2.13 -oidgroup IssuancePolicy

Confirm
Are you sure you want to perform this action?
Performing operation "Register object identifier with name: 'HighHardAdmin' and value: '1.2.826.0.1310.30.1.2.13'" on Target "DRCA-SANDPIT".
[Y] Yes [A] Yes to All [N] No [L] No to All [S] Suspend [?] Help (default is "Y"): y
Cannot convert argument "2", with value: "", for "Register" to type "System.Security.Cryptography.OidGroupEnum": "Cannot convert null to type "System.Security.Cryptography.OidGroupEnum" due to invalid enumeration values. Specify one of the following enumeration values and try again. The possible enumeration values are "AllGroups, HashAlgroithm, Encryption
Algorithm, PublicKeyAlgorithm, SignatureAlgorithm, RDNAttribute, ExtensionOrAttribute, ApplicationPolicy, IssuancePolicy, CertificateTemplate, KeyDerivationFunction"."
At C:\Windows\system32\WindowsPowerShell\v1.0\Modules\pspki\Client\Register-ObjectIdentifier.ps1:32 char:41
  • [Security.Cryptography.Oid2]::Register <<<< ($Value,$FriendlyName,$Group,$UseActiveDirectory,$LocaleId,$CPSLo
    cation)
    • CategoryInfo : NotSpecified: (:) [], MethodException
    • FullyQualifiedErrorId : MethodArgumentConversionInvalidCastArgument
Coordinator
Apr 4, 2014 at 5:33 AM
This is a bug. You can fix it yourself by editing Register-ObjectIdentifier.ps1 file as follows:
Locate this code part:
    $Group = switch ($OidGroup) {
        "ApplicationPolicy" {[Security.Cryptography.Oid2]::ApplicationPolicy}
        "IssuancePolicy" {[Security.Cryptography.Oid2]::IssuancePolicy}
    }
and replace with this one:
    $Group = switch ($OidGroup) {
        "ApplicationPolicy" {[Security.Cryptography.OidGroupEnum]::ApplicationPolicy}
        "IssuancePolicy" {[Security.Cryptography.OidGroupEnum]::IssuancePolicy}
    }
it is a typo in the enum class name.
Coordinator
Apr 4, 2014 at 5:35 AM
This discussion has been copied to a work item. Click here to go to the work item and continue the discussion.