certutil -oid 1 | findstr pwszCNGAlgid | findstr /v CryptOIDInfo
HashAlgorithm Hash algorithm is used for this requirement. Sha256, sha384, sha512, sha1, md5, md4, md2HashAlgorithm = sha1To see a list of supported hashing algorithms, use: certutil -oid 1 | findstr pwszCNGAlgid | findstr /v CryptOIDInfo
KeyAlgorithm The algorithm will be used by the service provider to create a public and private key pair. RSA, DH, DSA, ECDH_P256, ECDH_P521, ECDSA_P256, ECDSA_P384, ECDSA_P521 KeyAlgorithm = RSA KeyContainer This parameter should not be set for new requests, where the new key document is created. Key container is automatically created and maintained by the system. For requests using the current key document, this value can be set to key-container name of the current key. Use the certutil –key command to display the list of available key containers for the machine context. Use the certutil command –key –user for the context of the current user. Random string value certutil -oid 2 | findstr pwszCNGAlgid
The specified CSP to use also must support the algorithm and the corresponding encoding length specified.EncryptionAlgorithm = 3des EncryptionLength The length of the encryption algorithm used. Any length allowed by the specified encryption algorithm. EncryptionLength = 128 ProviderName Provider name is the display name of CSP. If you do not know the provider name of the CSP you are using, run certutil –csplist from a command line. The command will display the names of all CSPs available on the local system. ProviderName = "Microsoft RSA SChannel Cryptographic Provider" ProviderType Provider type is used to select specific vendors based on specific algorithm capabilities such as "RSA Full". If you do not know what type of CSP provider you are using, run certutil –csplist from a command line. The command displays the provider type of all CSPs available on the local system. ProviderType = 1 RenewalCert If you need to renew the certificate that exists on the system where the certificate request is created, you must specify its hash value as the value for this key. The hash value of any certificate is available at the computer where the certificate request was created. If you do not know the hash value of the certificate, use the Certificates MMC Snap-In and see if the certificate needs to be renewed. Open the certificate property and see the "Thumbprint" attribute of the certificate. Certificate extension requires PKCS # 7 or CMC format. RenewalCert = 4EDF274BD2919C6E9EC6A522F0F3B153E9B1582D RequesterName This section is optional.
OID extension Definition Example2.5.29.17 2.5.29.17 = "{text}" continue continue = "UPN=User@Domain.com&" continue continue = "EMail=User@Domain.com&" continue continue = "DNS = host .domain.com & " continue continue =" DirectoryName = CN = Name, DC = Domain, DC = com & " continue continue =" URL = http:///host.domain.com/default.html& " continue continue =" IPAddress = 10.0 .0.1 & " continue continue =" RegisteredId = 1.2.3.4.5 & " continue continue =" 1.2.3.4.6.1 = {utf8} String & " continue continue =" 1.2.3.4.6.2 = {octet} AAECAwQFBgc = & " continue continue = "1.2.3.4.6.2 = {octet} {hex} 00 01 02 03 04 05 06 07 &" continue continue = "1.2.3.4.6.3 = {asn} BAgAAQIDBAUGBw == &" continue continue = "1.2.3.4.6.3 = {hex} 04 08 00 01 02 03 04 05 06 07 "2.5.29.37 2.5.29.37 =" {text} " continue continue =" 1.3.6.1.5.5.7. continue continue = "1.3.6.1.5.5.7.3 .1 "2.5.29.19" {text} ca = 0pathlength = 3 "Critical Critical = 2.5.29.19 KeySpec AT_NONE - 0
AT_SIGNATURE - 2
AT_KEYEXCHANGE - 1 RequestType PKCS10 - 1
PKCS7 - 2
CMC - 3
Cert - 4 KeyUsage CERT_DIGITAL_SIGNATURE_KEY_USAGE - 80 (128)
CERT_NON_REPUDIATION_KEY_USAGE - 40 (64)
CERT_KEY_ENCIPHERMENT_KEY_USAGE - 20 (32)
CERT_DATA_ENCIPHERMENT_KEY_USAGE - 10 (16)
CERT_KEY_AGREEMENT_KEY_USAGE - 8
CERT_KEY_CERT_SIGN_KEY_USAGE - 4
CERT_OFFLINE_CRL_SIGN_KEY_USAGE - 2
CERT_CRL_SIGN_KEY_USAGE - 2
CERT_ENCIPHER_ONLY_KEY_USAGE - 1
CERT_DECIPHER_ONLY_KEY_USAGE - 8000 (32768) KeyUsageProperty NCRYPT_ALLOW_DECRYPT_FLAG - 1
NCRYPT_ALLOW_SIGNING_FLAG - 2
NCRYPT_ALLOW_KEY_AGREEMENT_FLAG - 4
NCRYPT_ALLOW_ALL_USAGES - ffffff (16777215) KeyProtection NCRYPT_UI_NO_PROTECTION_FLAG - 0
NCRYPT_UI_PROTECT_KEY_FLAG - 1
NCRYPT_UI_FORCE_HIGH_PROTECTION_FLAG - 2 SubjectNameFlags template CT_FLAG_SUBJECT_REQUIRE_COMMON_NAME - 40000000 (1073741824)
CT_FLAG_SUBJECT_REQUIRE_DIRECTORY_PATH - 80000000 (2147483648)
CT_FLAG_SUBJECT_REQUIRE_DNS_AS_CN - 10000000 (268435456)
CT_FLAG_SUBJECT_REQUIRE_EMAIL - 20000000 (536870912)
CT_FLAG_OLD_CERT_SUPPLIES_SUBJECT_AND_ALT_NAME - 8
CT_FLAG_SUBJECT_ALT_REQUIRE_DIRECTORY_GUID - 1000000 (16777216)
CT_FLAG_SUBJECT_ALT_REQUIRE_DNS - 8000000 (134217728)
CT_FLAG_SUBJECT_ALT_REQUIRE_DOMAIN_DNS - 400000 (4194304)
CT_FLAG_SUBJECT_ALT_REQUIRE_EMAIL - 4000000 (67108864)
CT_FLAG_SUBJECT_ALT_REQUIRE_SPN - 800000 (8388608)
CT_FLAG_SUBJECT_ALT_REQUIRE_UPN - 2000000 (33554432) X500NameFlags CERT_NAME_STR_NONE - 0
CERT_OID_NAME_STR - 2
CERT_X500_NAME_STR - 3
CERT_NAME_STR_SEMICOLON_FLAG - 40000000 (1073741824)
CERT_NAME_STR_NO_PLUS_FLAG - 20000000 (536870912)
CERT_NAME_STR_NO_QUOTING_FLAG - 10000000 (268435456)
CERT_NAME_STR_CRLF_FLAG - 8000000 (134217728)
CERT_NAME_STR_COMMA_FLAG - 4000000 (67108864)
CERT_NAME_STR_REVERSE_FLAG - 2000000 (33554432)
CERT_NAME_STR_FORWARD_FLAG - 1000000 (16777216)
CERT_NAME_STR_DISABLE_IE4_UTF8_FLAG - 10000 (65536)
CERT_NAME_STR_ENABLE_T61_UNICODE_FLAG - 20000 (131072)
CERT_NAME_STR_ENABLE_UTF8_UNICODE_FLAG - 40000 (262144)
CERT_NAME_STR_FORCE_UTF8_DIR_STR_FLAG - 80000 (524288)
CERT_NAME_STR_DISABLE_UTF8_DIR_STR_FLAG - 100000 (1048576)
CERT_NAME_STR_ENABLE_PUNYCODE_FLAG - 200000 (2097152)
Note:
SubjectNameFlags allow INF file to specify which Subject and SubjectAltName extension will be automatically filled by certreq based on the user or current machine properties: DNS name, UPN, etc. Using the word "template" means SubjectNameFlags used instead. This allows a single INF file to be used in many contexts, to create requirements that match each specific context.
X500NameFlags specifies flags that are passed directly to the CertStrToName API when the Subject INF keys are converted to the ASN.1 encoded Distinguished Name.
To request a certificate through the use of certreq, use the steps from the example below:
Warning
The content in this section is based on the default settings for Windows Server 2008 AD CS. For example, set the key length to 2048, select Microsoft Software Key Storage Provider as the CSP and use Secure Hash Algorithm 1 (SHA1). Please rate these options based on the requirements of your company's privacy policy.
To create a Policy File (.inf) and save the example below in Notepad as RequestConfig.inf:
[NewRequest] Subject = "CN=" Exportable = TRUE KeyLength = 2048 KeySpec = 1 KeyUsage = 0xf0 MachineKeySet = TRUE [RequestAttributes] CertificateTemplate="WebServer" [Extensions] OID = 1.3.6.1.5.5.7.3.1 OID = 1.3.6.1.5.5.7.3.2
On the computer on which you are requesting a certificate type, enter the following command:
CertReq –New RequestConfig.inf CertRequest.req
The following example illustrates the implementation of [Strings] section syntax for OIDs and other unexplained data. For example, the new {text} syntax for EKU extension, uses a comma-separated list of OIDs:
[Version] Signature="$Windows NT$ [Strings] szOID_ENHANCED_KEY_USAGE = "2.5.29.37" szOID_PKIX_KP_SERVER_AUTH = "1.3.6.1.5.5.7.3.1" szOID_PKIX_KP_CLIENT_AUTH = "1.3.6.1.5.5.7.3.2" [NewRequest] Subject = "CN=TestSelfSignedCert" Requesttype = Cert [Extensions] %szOID_ENHANCED_KEY_USAGE%="{text}%szOID_PKIX_KP_SERVER_AUTH%," _continue_ = "%szOID_PKIX_KP_CLIENT_AUTH%"
CertReq -accept [Options] [CertChainFileIn | FullResponseFileIn | CertFileIn]
The parameter –accept of the private key link created earlier with the certificate has been issued and removes the pending certificate request from the certificate request system (if required).
You can use this example to accept the certificate manually:
certreq -accept certnew.cer
Warning
The –accept parameter, the -user and -machine options indicate whether the cert is installed in the user or machine context. If there are special requirements in both contexts that match the currently installed public key, these options are not necessary. If there are no special requirements, then one of these requirements must be specified.
certreq -policy [-attrib AttributeString] [-binary] [-cert CertID] [RequestFileIn [PolicyFileIn [RequestFileOut [PKCS10FileOut]]]]
You can use this example to create a cross-certificate request:
certreq -policy Certsrv.req Policy.inf newcertsrv.req
certreq -sign [Options] [RequestFileIn [RequestFileOut]]
The following command sequence will show how to create a new certificate request, sign it and submit it:
certreq -new policyfile.inf MyRequest.req certreq -sign MyRequest.req MyRequest_Sign.req certreq -submit MyRequest_Sign.req MyRequest_cert.cer
To register for a certificate:
certreq –enroll [Options] TemplateName
To renew an existing certificate:
certreq –enroll –cert CertId [Options] Renew [ReuseKeys]
You can only renew a valid certificate on time. Expired certificates cannot be renewed and must be replaced with a new certificate.
Here is an example of certificate renewal with its serial number:
certreq –enroll -machine –cert "61 2d 3c fe 00 00 00 00 00 05" Renew
Below is an example of registering a certificate template called WebServer using an asterisk (*) to select a policy server via U / I:
certreq -enroll –machine –policyserver * "WebServer"
Option Description-any Force ICertRequest :: Submit to specify the encoding type. -attrib Specifies a pair of Name and Value strings, separated by colons.
Separate pairs of Name and Value strings with n (for example, Name1: Value1nName2: Value2). -binary Format the output file in binary instead of base64-encoded. -PolicyServer "ldap:"
Insert a unique URI or ID for the computer running the Certificate Enrollment Policy Web Service.
To determine that you want to use the required file by browsing, simply use the minus sign ( - ) for. -config Processing works by using the CA specified in the configuration string, is CAHostNameCAName. For https connections, specify the registered server URI. For local CA machines, use a minus sign (-). -Anonymous Use anonymous login information for Certificate Enrollment Web Services. -Kerberos Use Kerberos (domain) login information for Certificate Enrollment Web Services. -ClientCertificate You can replace with the thumbprint of certificate, CN, EKU, template, email, UPN and new syntax name = value. -UserName Used with Certificate Enrollment Web Services. You can replace it with the SAM name or domainuser name. This option is used with the -p parameter . -p Used with Certificate Enrollment Web Services. Replace with the actual user's password. This option is used with the option - UserName. -user Configures the user context for a new certificate request or specifies a certificate acceptance context. This is the default context, if there is not specified in INF or template. -machine Configure new certificate request or specify certificate acceptance context for machine context. For new requirements, it must match MachineKeyset's INF key and template context. If this option is not specified and the template does not have context, then the default is the user's context. -crl Include certificate revocation lists (CRL) in the output of the PKCS # 7 file specified by CertChainFileOut or base64 encoded file specified by RequestFileOut. -rpc Instructions for Active Directory Certificate Services (AD CS) to use a remote procedure server connection instead of Distributed COM. -AdminForceMachine Use the Key Service or alternative option to send a request from the local system context. The user who calls this option requires to be a local administrator. -RenewOnBehalfOf Send the renewal on behalf of the entity identified in the certificate. This option sets CR_IN_ROBO when calling ICertRequest :: Submit -f Force existing files to be overwritten. This also ignores the cached templates and policies. -q Use silent mode; Prevent all interaction reminders. -Unicode Writes Unicode output when standard output is redirected or leads to another command, useful when called from Windows PowerShell scripts). -UnicodeText Send Unicode output when writing base64 encoded data blocks to files.
Format DescriptionRequestFileIn Base64 encoded or binary input file name: Request for PKCS # 10 certificate, request for CMS certificate, request for renewal of PKCS # 7 certificate, X.509 certificate cross-validation, or request request a certificate of KeyGen tag format. RequestFileOut Base64 encoded output file name. CertFileOut The X-509 file name is Base64 encoded. PKCS10FileOut Only use Certreq -policy. The output file name of PKCS10 is encoded as Base64. CertChainFileOut The PKCS # 7 filename is Base64 encrypted. FullResponseFileOut The full response file name is Base64 encoded. PolicyFileIn Only use Certreq -policy. The INF file contains the text representation of the extensions used to meet the eligibility requirements.
See more: