How to configure Dart to use SSL CA certificate?

I recently deployed a Dart server application that serves HTTP requests. I wanted to add support for HTTPS, so I tried to add SSL to the Dart server application.

This answer provides a clear explanation of how to add a self-signed SSL certificate to Dart. However, I want to add the SSL certificate that I purchased from the SSL provider.

The SSL provider emailed me my 4 files:

  • CA root certificate - AddTrustExternalCARoot.crt
  • CA Intermediate Certificate - COMODORSAAddTrustCA.crt
  • CA Intermediate Certificate - COMODORSADomainValidationSecureServerCA.crt
  • Your PositiveSSL Certificate - my_domain.crt

I tried to figure out how it works certutiland how to add these certificates to the certificate database, but I just can't figure it all out.

Anyone with experience with CA SSL certificate in Dart?

SOLVED : thanks to the suggestion in the comments, I solved the problem. This is the essence of my full setup: https://gist.github.com/stevenroose/e6abde14258971eae982

+2
source share
2 answers

First of all, you probably have three files generated using openssl for your private key, server certificate, and CA certificate. To convert all this to a PKCS12 file, you can use openssl:

openssl pkcs12 -export -out server.p12 -inkey server.key -in server.crt -certfile CAcert.crt

certutil, PKCS12 :

certutil -N -d sql:certdb
certutil -A -n mycertnick -i server.crt -t "TCu,Cu,Tuw" -d sql:certdb
certutil -A -n myCA -i CAcert.crt -t "TCu,Cu,Tuw" -d sql:certdb
pk12util -i server.p12 -d sql:certdb

, .

+3

All Articles