Estou tentando criar manualmente uma chave e CSR para uma nova CA subordinada corporativa do Windows AD CS (Windows Server 2019).
Gostaria de armazenar a chave no moderno Microsoft Software Key Storage Provider .
Ele falha com Provider type not defined. 0x80090017 (-2146893801 NTE_PROV_TYPE_NOT_DEF)
.
O comando que uso é:certreq.exe -new C:\requestconfig.inf C:\certificate.req
O C:\requestconfig.inf
arquivo é esse:
[Version]
Signature= "$Windows NT$"
[NewRequest]
Subject = "CN=My Subordinate CA"
HashAlgorithm = sha256
KeyAlgorithm = RSA
KeyLength = 2048
ProviderName = "Microsoft Software Key Storage Provider"
KeyContainer = "My Subordinate CA"
ExportableEncrypted = true
MachineKeySet = true
RequestType = PKCS10
SuppressDefaults = true
SecurityDescriptor = "D:P(A;OICI;0xd01f01ff;;;BA)(A;OICI;0xd01f01ff;;;SY)"
[RequestAttributes]
CertificateTemplate = SubCA
[Extensions]
2.5.29.15 = "{critical}{hex}03020186" ; Key Usage (critical): Digital Signature, Certificate Signing, CRL Signing
2.5.29.19 = "{critical}{text}ca=1&pathlength=1" ; Basic Constraints (critical)
1.3.6.1.4.1.311.21.1 = "{hex}020100" ; CA Version V0.0
Etapas de solução de problemas
Verifiquei se o CSP é válido executando certutil -csplist
:
[...]
Provider Name: Microsoft Strong Cryptographic Provider
Provider Type: 1 - PROV_RSA_FULL
Provider Name: Microsoft Software Key Storage Provider
Provider Name: Microsoft Passport Key Storage Provider
[...]
Ele não tem um tipo de provedor, mas mesmo assim, adicionei ProviderType = 0
e ProviderType = 1
à configuração, sem sucesso.
Consegui usar uma configuração muito semelhante para criar meu certificado raiz:
[Version]
Signature= "$Windows NT$"
[NewRequest]
Subject = "CN=My Root CA"
HashAlgorithm = sha256
KeyAlgorithm = RSA
KeyLength = 4096
;KeyUsage = CERT_DIGITAL_SIGNATURE_KEY_USAGE | CERT_KEY_CERT_SIGN_KEY_USAGE | CERT_CRL_SIGN_KEY_USAGE
ProviderName = "Microsoft Software Key Storage Provider"
KeyContainer = "My Root CA"
ExportableEncrypted = true
MachineKeySet = true
RequestType = Cert
SuppressDefaults = true
SecurityDescriptor = "D:P(A;OICI;0xd01f01ff;;;BA)(A;OICI;0xd01f01ff;;;SY)
[Extensions]
2.5.29.15 = {critical}{hex}03020186 ; Key Usage (critical): Digital Signature, Certificate Signing, CRL Signing
2.5.29.19 = {critical}{text}ca=1&pathlength=None ; Basic Constraints (critical)
1.3.6.1.4.1.311.21.1 = {hex}020100 ; CA Version V0.0
A principal diferença é que, com essa configuração, crio uma chave e um certificado em vez de uma chave e CSR. As diferenças são: RequestType
é Cert
e não PKCS10
e não tem a RequestAttributes
seção. Esta configuração não falhou com o NTE_PROV_TYPE_NOT_DEF
.
O que está causando a falha repentina com a configuração da minha sub CA?
Você tem que adicionar:
para
NewRequest
seção. certreq assume como padrãoAT_EXCHANGE
enquanto os provedores CNG não suportam KeySpec.Apenas por curiosidade, por que você não usa o assistente de instalação do ADCS CA para gerar a solicitação de CA?