我正在使用C#(或VBScript)从企业CA颁发证书。
根据这个答案 ,我需要指定OID而不是证书名称,并将其放在意想不到的代码部分。 (恕我直言,我应该把它放在空string的地方)
我正在查看证书pipe理器,模板et.al,并找不到我应该使用的OID。 有什么build议吗?
证书模板存储在Active Directory的configuration分区中。
例如,如果您的证书模板被命名为“智能卡”,则其DN将是:
CN=Smartcard,CN=Certificate Templates,CN=Public Key Services,CN=Services,CN=Configuration,DC=Contoso,DC=Com
该对象的msPKI-Cert-Template-OID属性包含您所寻找的OID。
编辑:这里是一些Powershell:
PS C:\Users\Ryan> Get-ADObject 'CN=Smartcard,CN=Certificate Templates,CN=Public Key Services,CN=Services,CN=Configuration,DC=Contoso,DC=Com' -Properties msPKI-Cert-Template-OID DistinguishedName : CN=Smartcard,CN=Certificate Templates,CN=Public Key Services,CN=Services,CN=Configuration,DC=Contoso,DC=Com msPKI-Cert-Template-OID : 1.3.6.1.4.1.311.21.8.13882702.11110958.1330334.1890290.2281445.541.2.14 Name : Smartcard ObjectClass : pKICertificateTemplate ObjectGUID : 1cd4698d-56fe-4d4b-8005-f89a76d24ae1
我在查找证书模板的专有名称时遇到了麻烦,所以通过执行以下步骤,我find了与其他答案不同的方法:
我想你可能需要整个string为您的域OID。
Get-ADObject ('CN=OID,CN=Public Key Services,CN=Services,'+(Get-ADRootDSE).configurationNamingContext) -Properties msPKI-Cert-Template-OID | Select-Object -ExpandProperty msPKI-Cert-Template-OID