Example program demonstrating use of HTTP or HTTPS protocol over a cellular connection with httpbin.org using the MTSAS library. (Demonstrates GET,POST,basic-auth)

Dependencies:   mbed mtsas

Embed: (wiki syntax)

« Back to documentation index

Show/hide line numbers certs.h Source File

certs.h

00001 /** Any non-root certificates will have no effect on the SSL client, but will
00002  * use up extra space for their allocation into the certificate list.
00003  * Methods for obtaining the Root CA certificate(s) for a website:
00004  * 1. Open a browser to the target website using HTTPS. 
00005  *      (These instructions are for Chrome, but should be similar for other browsers)
00006  *      Click on the lock icon at the beginning of the url, select the "connection" tab,
00007  *      and click the "certificate information" hyperlink. The browser will open a new window
00008  *      labeled "Certificate". Switch to the "Certification Path" tab, click the certificate 
00009  *      closest to the top of the window, then click "View Certificate". This will open a new
00010  *      window labeled "Certificate" again. This time, click on the "Details" tab, then click 
00011  *      "Copy to File". This will open a "Certificate Export Wizard". Click next, and choose the 
00012  *      "Base-64 encoded X.509 (.CER)" option, then click next. Choose the name and location where
00013  *      you want to save the PEM formatted certificate, then click next, then finish. Open the file
00014  *      that was created and copy-paste the certificate into this certs.h file. Format the certificate
00015  *      data so that each line begins with " and is appended with \r\n"
00016  *
00017  * 2. Go to https://www.bluessl.com/en/ssltest and enter the website for which you wish to get the root CA
00018  *      certificates. Click the [Click here to download the public part of this certificate] button located
00019  *      underneath the certificates that label themselves as Root, or Root CA. The root CA certificate should
00020  *      self-signed, otherwise it is not the root CA certificate. Take the downloaded file, copy the data
00021  *      into this certs.h file, and format the data so that each line begins with " and is appended with \r\n"
00022  *      
00023  * 3. Using openssl on linux: (Make sure you have openssl installed.) Run the command: openssl s_client
00024  *      -showcerts -connect <host>:<port> -CApath /etc/ssl/certs
00025  *      Where <host> is the host name (www.google.com for example), and port is the port on which the connection
00026  *      will be made (usually 443). When the connection is made with the remote server, the last certificate(s)
00027  *      listed will be the Root CA certificate(s). Merely copy-paste those certificates into this certs.h file
00028  *      and format them with each line beginning with " and ending with \r\n"
00029  *      
00030  */
00031 
00032 
00033 //Root Certificates
00034 char CERTIFICATES[1547] = 
00035     
00036     //Root certificate Authority for Httpbin.org
00037     "-----BEGIN CERTIFICATE-----\r\n"
00038     "MIIENjCCAx6gAwIBAgIBATANBgkqhkiG9w0BAQUFADBvMQswCQYDVQQGEwJTRTEU\r\n"
00039     "MBIGA1UEChMLQWRkVHJ1c3QgQUIxJjAkBgNVBAsTHUFkZFRydXN0IEV4dGVybmFs\r\n"
00040     "IFRUUCBOZXR3b3JrMSIwIAYDVQQDExlBZGRUcnVzdCBFeHRlcm5hbCBDQSBSb290\r\n"
00041     "MB4XDTAwMDUzMDEwNDgzOFoXDTIwMDUzMDEwNDgzOFowbzELMAkGA1UEBhMCU0Ux\r\n"
00042     "FDASBgNVBAoTC0FkZFRydXN0IEFCMSYwJAYDVQQLEx1BZGRUcnVzdCBFeHRlcm5h\r\n"
00043     "bCBUVFAgTmV0d29yazEiMCAGA1UEAxMZQWRkVHJ1c3QgRXh0ZXJuYWwgQ0EgUm9v\r\n"
00044     "dDCCASIwDQYJKoZIhvcNAQEBBQADggEPADCCAQoCggEBALf3GjPm8gAELTngTlvt\r\n"
00045     "H7xsD821+iO2zt6bETOXpClMfZOfvUq8k+0DGuOPz+VtUFrWlymUWoCwSXrbLpX9\r\n"
00046     "uMq/NzgtHj6RQa1wVsfwTz/oMp50ysiQVOnGXw94nZpAPA6sYapeFI+eh6FqUNzX\r\n"
00047     "mk6vBbOmcZSccbNQYArHE504B4YCqOmoaSYYkKtMsE8jqzpPhNjfzp/haW+710LX\r\n"
00048     "a0Tkx63ubUFfclpxCDezeWWkWaCUN/cALw3CknLa0Dhy2xSoRcRdKn23tNbE7qzN\r\n"
00049     "E0S3ySvdQwAl+mG5aWpYIxG3pzOPVnVZ9c0p10a3CitlttNCbxWyuHv77+ldU9U0\r\n"
00050     "WicCAwEAAaOB3DCB2TAdBgNVHQ4EFgQUrb2YejS0Jvf6xCZU7wO94CTLVBowCwYD\r\n"
00051     "VR0PBAQDAgEGMA8GA1UdEwEB/wQFMAMBAf8wgZkGA1UdIwSBkTCBjoAUrb2YejS0\r\n"
00052     "Jvf6xCZU7wO94CTLVBqhc6RxMG8xCzAJBgNVBAYTAlNFMRQwEgYDVQQKEwtBZGRU\r\n"
00053     "cnVzdCBBQjEmMCQGA1UECxMdQWRkVHJ1c3QgRXh0ZXJuYWwgVFRQIE5ldHdvcmsx\r\n"
00054     "IjAgBgNVBAMTGUFkZFRydXN0IEV4dGVybmFsIENBIFJvb3SCAQEwDQYJKoZIhvcN\r\n"
00055     "AQEFBQADggEBALCb4IUlwtYj4g+WBpKdQZic2YR5gdkeWxQHIzZlj7DYd7usQWxH\r\n"
00056     "YINRsPkyPef89iYTx4AWpb9a/IfPeHmJIZriTAcKhjW88t5RxNKWt9x+Tu5w/Rw5\r\n"
00057     "6wwCURQtjr0W4MHfRnXnJK3s9EK0hZNwEGe6nQY1ShjTK3rMUUKhemPR5ruhxSvC\r\n"
00058     "Nr4TDea9Y355e6cJDUCrat2PisP29owaQgVR1EX1n6diIWgVIEM8med8vSTYqZEX\r\n"
00059     "c4g/VhsxOBi0cQ+azcgOno4uG+GMmIPLHzHxREzGBHNJdmAPx/i9F4BrLunMTA5a\r\n"
00060     "mnkPIAou1Z5jJh5VkpTYghdae9C8x49OhgQ=\r\n"
00061     "-----END CERTIFICATE-----\r\n"
00062     ;