%3CLINGO-SUB%20id%3D%22lingo-sub-1128529%22%20slang%3D%22en-US%22%3EHow%20to%20create%20a%20web%20server%20SSL%20certificate%20manually%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-1128529%22%20slang%3D%22en-US%22%3E%3CP%3E%3CSTRONG%3E%20First%20published%20on%20TECHNET%20on%20Aug%2005%2C%202009%20%3C%2FSTRONG%3E%3C%2FP%3E%0A%3CP%3E%3CFONT%20color%3D%22%23008080%22%3E%20The%20Internet%20Information%20Server%20(IIS)%20and%20Microsoft%20Internet%20Security%20and%20Acceleration%20(ISA)%20provide%20wizards%20in%20the%20administration%20user%20interface%20to%20request%20and%20install%20SSL%20certificates.%20With%20this%20blog%20post%20I%20want%20to%20explain%20how%20to%20request%20a%20SSL%20server%20certificate%20manually.%20The%20manual%20steps%20are%20required%20if%20the%20Certification%20Authority%20(CA)%20is%20not%20available%20in%20the%20same%20forest%20as%20the%20IIS%20or%20ISA%20is%20a%20member%20of.%20%3C%2FFONT%3E%3C%2FP%3E%0A%3CP%3E%3CFONT%20color%3D%22%23008080%22%3E%20%3CU%3E%201.%20Creating%20an%20INF%20file%20to%20set%20the%20certificate%20properties%20%3C%2FU%3E%20%3C%2FFONT%3E%3C%2FP%3E%0A%3CP%3E%3CFONT%20color%3D%22%23008080%22%3E%20Use%20Notepad%20to%20modify%20the%20following%20sample%20INF%20file%20according%20to%20your%20needs.%20Safe%20the%20file%20as%20%3CEM%3E%20ssl.inf%20%3C%2FEM%3E%20for%20example%20%3C%2FFONT%3E%3C%2FP%3E%0A%3CP%3E%3CFONT%20size%3D%222%22%3E%20%3CFONT%20face%3D%22Courier%20New%22%3E%5BVersion%5D%20%3CBR%20%2F%3E%3C%2FFONT%3E%20%3CFONT%20face%3D%22Courier%20New%22%3E%20Signature%3D%22%24Windows%20NT%24%22%3C%2FFONT%3E%20%3C%2FFONT%3E%3C%2FP%3E%0A%3CP%3E%3CFONT%20face%3D%22Courier%20New%22%20size%3D%222%22%3E%5BNewRequest%5D%20%3CBR%20%2F%3ESubject%20%3D%20%22CN%3DSERVER.CONTOSO.COM%22%26nbsp%3B%26nbsp%3B%20%3B%20For%20a%20wildcard%20use%20%22CN%3D*.CONTOSO.COM%22%20for%20example%20%3CBR%20%2F%3E%3B%20For%20an%20empty%20subject%20use%20the%20following%20line%20instead%20or%20remove%20the%20Subject%20line%20entierely%20%3CBR%20%2F%3E%3B%20Subject%20%3D%20%3C%2FFONT%3E%20%3CFONT%20face%3D%22Courier%20New%22%20size%3D%222%22%3E%20%3CBR%20%2F%3EExportable%20%3D%20FALSE%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%20%3B%20Private%20key%20is%20not%20exportable%20%3CBR%20%2F%3EKeyLength%20%3D%202048%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%20%3B%20Common%20key%20sizes%3A%20512%2C%201024%2C%202048%2C%204096%2C%208192%2C%2016384%20%3CBR%20%2F%3EKeySpec%20%3D%201%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%20%3B%20AT_KEYEXCHANGE%20%3CBR%20%2F%3EKeyUsage%20%3D%200xA0%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%20%3B%20Digital%20Signature%2C%20Key%20Encipherment%20%3CBR%20%2F%3EMachineKeySet%20%3D%20True%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%20%3B%20The%20key%20belongs%20to%20the%20local%20computer%20account%20%3CBR%20%2F%3EProviderName%20%3D%20%22Microsoft%20RSA%20SChannel%20Cryptographic%20Provider%22%20%3CBR%20%2F%3EProviderType%20%3D%2012%20%3CBR%20%2F%3ESMIME%20%3D%20FALSE%20%3CBR%20%2F%3ERequestType%20%3D%20CMC%3C%2FFONT%3E%3C%2FP%3E%0A%3CP%3E%3CFONT%20face%3D%22Courier%20New%22%20size%3D%222%22%3E%20%3B%20At%20least%20certreq.exe%20shipping%20with%20Windows%20Vista%2FServer%202008%20is%20required%20to%20interpret%20the%20%5BStrings%5D%20and%20%5BExtensions%5D%20sections%20below%20%3C%2FFONT%3E%3C%2FP%3E%0A%3CP%3E%3CFONT%20face%3D%22Courier%20New%22%20size%3D%222%22%3E%20%5BStrings%5D%20%3CBR%20%2F%3EszOID_SUBJECT_ALT_NAME2%20%3D%20%222.5.29.17%22%20%3CBR%20%2F%3EszOID_ENHANCED_KEY_USAGE%20%3D%20%222.5.29.37%22%20%3CBR%20%2F%3EszOID_PKIX_KP_SERVER_AUTH%20%3D%20%221.3.6.1.5.5.7.3.1%22%20%3CBR%20%2F%3EszOID_PKIX_KP_CLIENT_AUTH%20%3D%20%221.3.6.1.5.5.7.3.2%22%20%3C%2FFONT%3E%3C%2FP%3E%0A%3CP%3E%3CFONT%20face%3D%22Courier%20New%22%20size%3D%222%22%3E%20%5BExtensions%5D%20%3CBR%20%2F%3E%25szOID_SUBJECT_ALT_NAME2%25%20%3D%20%22%7Btext%7Ddns%3Dcomputer1.contoso.com%26amp%3Bdns%3Dcomputer2.contoso.com%22%20%3CBR%20%2F%3E%25szOID_ENHANCED_KEY_USAGE%25%20%3D%20%22%7Btext%7D%25szOID_PKIX_KP_SERVER_AUTH%25%2C%25szOID_PKIX_KP_CLIENT_AUTH%25%22%20%3C%2FFONT%3E%3C%2FP%3E%0A%3CP%3E%3CFONT%20face%3D%22Courier%20New%22%20size%3D%222%22%3E%20%5BRequestAttributes%5D%20%3CBR%20%2F%3ECertificateTemplate%3D%20WebServer%20%3C%2FFONT%3E%3C%2FP%3E%0A%3CP%3E%3CFONT%20color%3D%22%23008080%22%3E%20%3CSTRONG%3E%20Notes%3A%20%3C%2FSTRONG%3E%20%3C%2FFONT%3E%3C%2FP%3E%0A%3CUL%3E%0A%3CLI%3E%3CFONT%20color%3D%22%23008080%22%3E%20leave%20off%20the%20%3CEM%3E%20Subject%3D%20%3C%2FEM%3E%20line%20if%20you%20want%20the%20subject%20to%20be%20empty%20%3C%2FFONT%3E%3C%2FLI%3E%0A%3CLI%3E%3CFONT%20color%3D%22%23008080%22%3E%20if%20you%20don%E2%80%99t%20need%20the%20template%20to%20be%20specified%2C%20remove%20the%20%3CEM%3E%20RequestAttributes%20%3C%2FEM%3E%20section%20%3C%2FFONT%3E%3C%2FLI%3E%0A%3CLI%3E%3CFONT%20color%3D%22%23008080%22%3E%20the%20specification%20of%20the%20enhanced%20key%20usage%20OID%20is%20not%20explicitly%20required%20since%20the%20EKU%20is%20defined%20in%20the%20certificate%20template.%20The%20OID%20in%20the%20INF%20file%20above%20is%20for%20explanatory%20purposes%20%3C%2FFONT%3E%3C%2FLI%3E%0A%3CLI%3E%3CFONT%20color%3D%22%23008080%22%3E%20you%20can%20click%20on%20%E2%80%9COK%E2%80%9D%20for%20the%20template%20not%20found%20UI%20from%20%3CEM%3E%20certreq%20%3C%2FEM%3E%20if%20the%20client%20has%20no%20access%20to%20templates%20%3C%2FFONT%3E%3C%2FLI%3E%0A%3CLI%3E%3CFONT%20color%3D%22%23008080%22%3E%20you%20can%20ignore%20the%20unreferenced%20%E2%80%9C%5BStrings%5D%E2%80%9D%20section%20dialog%20when%20it%20appears%20%3C%2FFONT%3E%3C%2FLI%3E%0A%3C%2FUL%3E%0A%3CP%3E%3CFONT%20color%3D%22%23008080%22%3E%20%3CU%3E%202.%20Compiling%20the%20INF%20file%20into%20a%20REQ%20file%20%3C%2FU%3E%20%3C%2FFONT%3E%3C%2FP%3E%0A%3CP%3E%3CFONT%20color%3D%22%23008080%22%3E%20The%20following%20command-line%20command%20will%20generate%20key%20material%20and%20turn%20the%20INF%20file%20into%20a%20certificate%20request.%20%3C%2FFONT%3E%3C%2FP%3E%0A%3CP%3E%3CFONT%20face%3D%22Courier%20New%22%20size%3D%222%22%3E%20certreq%20%E2%80%93new%20ssl.inf%20ssl.req%20%3C%2FFONT%3E%3C%2FP%3E%0A%3CP%3E%3CFONT%20color%3D%22%23008080%22%3E%20Once%20the%20certificate%20request%20was%20created%20you%20can%20verify%20the%20request%20with%20the%20following%20command%3A%20%3C%2FFONT%3E%3C%2FP%3E%0A%3CP%3E%3CFONT%20face%3D%22Courier%20New%22%20size%3D%222%22%3E%20certutil%20ssl.req%20%3C%2FFONT%3E%3C%2FP%3E%0A%3CP%3E%3CFONT%20color%3D%22%23008080%22%3E%20%3CU%3E%203.%20Submitting%20the%20REQ%20file%20to%20the%20CA%20%3C%2FU%3E%20%3C%2FFONT%3E%3C%2FP%3E%0A%3CP%3E%3CFONT%20color%3D%22%23008080%22%3E%20If%20the%20CA%20is%20reachable%20via%20RPC%20over%20the%20network%2C%20use%20the%20following%20command%20to%20submit%20the%20certificate%20request%20to%20the%20CA%3A%20%3C%2FFONT%3E%3C%2FP%3E%0A%3CP%3E%3CFONT%20face%3D%22Courier%20New%22%20size%3D%222%22%3E%20certreq%20%E2%80%93submit%20ssl.req%20%3C%2FFONT%3E%3C%2FP%3E%0A%3CP%3E%3CFONT%20face%3D%22ver%22%20color%3D%22%23408080%22%3E%20You%20will%20get%20a%20selection%20dialog%20to%20select%20the%20CA%20from.%20If%20the%20CA%20is%20configured%20to%20issue%20certificates%20based%20on%20the%20template%20settings%2C%20the%20CA%20may%20issue%20the%20certificate%20immediately.%20%3C%2FFONT%3E%3C%2FP%3E%0A%3CP%3E%3CFONT%20color%3D%22%23408080%22%3E%20If%20RPC%20traffic%20is%20not%20allowed%20between%20the%20computer%20where%20the%20certificate%20request%20was%20created%20and%20the%20CA%2C%20transfer%20the%20certificate%20request%20to%20the%20CA%20and%20perform%20the%20above%20command%20locally%20at%20the%20CA.%20%3C%2FFONT%3E%3C%2FP%3E%0A%3CP%3E%3CFONT%20color%3D%22%23408080%22%3E%20If%20the%20certificate%20template%20name%20was%20not%20specified%20in%20the%20certificate%20request%20above%2C%20you%20can%20specify%20it%20as%20part%20of%20the%20submission%20command%3A%20%3C%2FFONT%3E%3C%2FP%3E%0A%3CP%3E%3CFONT%20face%3D%22Courier%20New%22%20size%3D%222%22%3E%20certreq%20-attrib%20%22CertificateTemplate%3Awebserver%22%20%E2%80%93submit%20ssl.req%20%3C%2FFONT%3E%3C%2FP%3E%0A%3CP%3E%3CFONT%20color%3D%22%23008080%22%3E%20%3CU%3E%204.%20Installing%20the%20certificate%20at%20the%20IIS%20or%20ISA%20computer%20%3C%2FU%3E%20%3C%2FFONT%3E%3C%2FP%3E%0A%3CP%3E%3CFONT%20color%3D%22%23008080%22%3E%20Once%20the%20certificate%20was%20issued%20and%20is%20available%20as%20a%20file%20on%20the%20target%20computer%2C%20use%20the%20following%20command%20to%20install%20it.%20%3C%2FFONT%3E%3C%2FP%3E%0A%3CP%3E%3CFONT%20face%3D%22Courier%20New%22%20size%3D%222%22%3E%20certreq%20%E2%80%93accept%20ssl.cer%20%3C%2FFONT%3E%3C%2FP%3E%0A%3CP%3E%3CFONT%20color%3D%22%23008080%22%3E%20The%20installation%20actually%20puts%20the%20certificate%20into%20the%20computer%E2%80%99s%20personal%20store%2C%20links%20it%20with%20the%20key%20material%20created%20in%20step%20%231%20and%20builds%20the%20certificate%20property.%20The%20certificate%20property%20stores%20information%20such%20as%20the%20friendly%20name%20which%20is%20not%20part%20of%20a%20certificate.%20%3C%2FFONT%3E%3C%2FP%3E%0A%3CP%3E%3CFONT%20color%3D%22%23008080%22%3E%20After%20performing%20steps%201%20to%204%20the%20certificate%20will%20show%20up%20in%20the%20IIS%20or%20ISA%20management%20interface%20and%20can%20be%20bound%20to%20a%20web%20site%20or%20a%20SSL%20listener.%20%3C%2FFONT%3E%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-TEASER%20id%3D%22lingo-teaser-1128529%22%20slang%3D%22en-US%22%3E%3CP%3EFirst%20published%20on%20TECHNET%20on%20Aug%2005%2C%202009%20The%20Internet%20Information%20Server%20(IIS)%20and%20Microsoft%20Internet%20Security%20and%20Acceleration%20(ISA)%20provide%20wizards%20in%20the%20administration%20user%20interface%20to%20request%20and%20install%20SSL%20certificates.%3C%2FP%3E%3C%2FLINGO-TEASER%3E%3CLINGO-LABS%20id%3D%22lingo-labs-1128529%22%20slang%3D%22en-US%22%3E%3CLINGO-LABEL%3ECarstenKinder%3C%2FLINGO-LABEL%3E%3C%2FLINGO-LABS%3E
Microsoft

First published on TECHNET on Aug 05, 2009

The Internet Information Server (IIS) and Microsoft Internet Security and Acceleration (ISA) provide wizards in the administration user interface to request and install SSL certificates. With this blog post I want to explain how to request a SSL server certificate manually. The manual steps are required if the Certification Authority (CA) is not available in the same forest as the IIS or ISA is a member of.

1. Creating an INF file to set the certificate properties

Use Notepad to modify the following sample INF file according to your needs. Safe the file as ssl.inf for example

[Version]
Signature="$Windows NT$"

[NewRequest]
Subject = "CN=SERVER.CONTOSO.COM"   ; For a wildcard use "CN=*.CONTOSO.COM" for example
; For an empty subject use the following line instead or remove the Subject line entierely
; Subject =

Exportable = FALSE                  ; Private key is not exportable
KeyLength = 2048                    ; Common key sizes: 512, 1024, 2048, 4096, 8192, 16384
KeySpec = 1                         ; AT_KEYEXCHANGE
KeyUsage = 0xA0                     ; Digital Signature, Key Encipherment
MachineKeySet = True                ; The key belongs to the local computer account
ProviderName = "Microsoft RSA SChannel Cryptographic Provider"
ProviderType = 12
SMIME = FALSE
RequestType = CMC

; At least certreq.exe shipping with Windows Vista/Server 2008 is required to interpret the [Strings] and [Extensions] sections below

[Strings]
szOID_SUBJECT_ALT_NAME2 = "2.5.29.17"
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"

[Extensions]
%szOID_SUBJECT_ALT_NAME2% = "{text}dns=computer1.contoso.com&dns=computer2.contoso.com"
%szOID_ENHANCED_KEY_USAGE% = "{text}%szOID_PKIX_KP_SERVER_AUTH%,%szOID_PKIX_KP_CLIENT_AUTH%"

[RequestAttributes]
CertificateTemplate= WebServer

Notes:

  • leave off the Subject= line if you want the subject to be empty
  • if you don’t need the template to be specified, remove the RequestAttributes section
  • the specification of the enhanced key usage OID is not explicitly required since the EKU is defined in the certificate template. The OID in the INF file above is for explanatory purposes
  • you can click on “OK” for the template not found UI from certreq if the client has no access to templates
  • you can ignore the unreferenced “[Strings]” section dialog when it appears

2. Compiling the INF file into a REQ file

The following command-line command will generate key material and turn the INF file into a certificate request.

certreq –new ssl.inf ssl.req

Once the certificate request was created you can verify the request with the following command:

certutil ssl.req

3. Submitting the REQ file to the CA

If the CA is reachable via RPC over the network, use the following command to submit the certificate request to the CA:

certreq –submit ssl.req

You will get a selection dialog to select the CA from. If the CA is configured to issue certificates based on the template settings, the CA may issue the certificate immediately.

If RPC traffic is not allowed between the computer where the certificate request was created and the CA, transfer the certificate request to the CA and perform the above command locally at the CA.

If the certificate template name was not specified in the certificate request above, you can specify it as part of the submission command:

certreq -attrib "CertificateTemplate:webserver" –submit ssl.req

4. Installing the certificate at the IIS or ISA computer

Once the certificate was issued and is available as a file on the target computer, use the following command to install it.

certreq –accept ssl.cer

The installation actually puts the certificate into the computer’s personal store, links it with the key material created in step #1 and builds the certificate property. The certificate property stores information such as the friendly name which is not part of a certificate.

After performing steps 1 to 4 the certificate will show up in the IIS or ISA management interface and can be bound to a web site or a SSL listener.