I want to make SQL server connection encrypted. I know that a certificate is needed, but I haven't been able to.

So far, I:

  • created certificate in IIS.
  • added certificate in MMC "Certificates" snap-in.
  • in SQL Server Configuration manager for my server:
    • registered certificate
    • forced secure login
    • stopped & started "MSSQLSERVER" service

Starting SQL Server service always throws an error. Is there something wrong with the above steps? What are the correct steps?

I am using SQL Server 2012 and Windows Server 2012 R2.

  • When dealing with an error, please specify the error message in the question.
    – outis
    Nov 2, 2014 at 6:37

2 Answers 2


To create a certificate for SSL encryption for SQL Server you need a certificate for Server authentciation. That is [EnhancedKeyUsageExtension] OID =

If you want to manually create a certificate for this using Windows Certificate services you need to do it like this.


Create a file named cert.inf

Subject = "CN=*FQDN*"
HashAlgorithm =  SHA256
KeyLength = 2048
Exportable = TRUE
KeySpec = 1
KeyUsage = 0x20
MachineKeySet = TRUE
ProviderName = "Microsoft RSA SChannel Cryptographic Provider"
ProviderType = 12 
CertificateTemplate= WebServer

And then generate the certificate using CERTREG.EXE

Certreq –new cert.inf cert.req
Certreq –submit cert.reg

To do the same using OpenSSL

# generate key    
openssl genrsa -des3 -out server.key 2048

# remove pass
openssl rsa -in server.key -out server.key

# generate sign request, be sure to include the correct FQDN
# (host name followed by primary dns suffix)
openssl req -new -key server.key -out server.csr

# generate self signed certificate
openssl x509 -req -in server.csr -signkey server.key -out server.crt

# include both the certificate and the private key in a PKCS12 keystore
# (leave the export key empty)
openssl pkcs12 -export -out server.p12 -inkey server.key -in server.crt

In both cases you end up with a CRT that you can import to the machine store of the SQL Server and then use the SQL server configuration manager to encrypt the connections. You will have to trust the root certificate in the latter case though and in the former case, if you are not running on a domain you will have to install the root certificate for the windows CSA on both the machines


I noticed this question is a bit old, but if you (or anybody reading this) is still wondering how to implement SSL encryption here is a blog post I wrote recently describing my journey to implement and test this stuff on a cluster.

It is a pretty detailed post that described each and every step I had to do to implement SSL (together with certificates) for a request coming from my employer that I tackled very recently.



Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.