http_get_mbedtls example: Update for howsmyssl.com server-side changes

New letsencrypt CA cert since they left beta, and HTTP server now
expects a Host header.
This commit is contained in:
Angus Gratton 2016-04-20 09:23:00 +10:00
parent 8453445620
commit 1c998a3edf
2 changed files with 33 additions and 32 deletions

View file

@ -1,43 +1,44 @@
/* This is the root certificate for the CA trust chain of /* This is the CA certificate for the CA trust chain of
www.howsmyssl.com in PEM format, as dumped via: www.howsmyssl.com in PEM format, as dumped via:
openssl s_client -showcerts -connect www.howsmyssl.com:443 </dev/null openssl s_client -showcerts -connect www.howsmyssl.com:443 </dev/null
The root cert is the last cert in the chain output by the server. The CA cert is the last cert in the chain output by the server.
*/ */
#include <stdio.h> #include <stdio.h>
#include <stdint.h> #include <stdint.h>
#include <string.h> #include <string.h>
/*
1 s:/C=US/O=Let's Encrypt/CN=Let's Encrypt Authority X3
i:/O=Digital Signature Trust Co./CN=DST Root CA X3
*/
const char *server_root_cert = "-----BEGIN CERTIFICATE-----\r\n" const char *server_root_cert = "-----BEGIN CERTIFICATE-----\r\n"
"MIIFNzCCBB+gAwIBAgISAfl7TPw6Mf/F6VCBc5eaHA7kMA0GCSqGSIb3DQEBCwUA\r\n" "MIIEkjCCA3qgAwIBAgIQCgFBQgAAAVOFc2oLheynCDANBgkqhkiG9w0BAQsFADA/\r\n"
"MEoxCzAJBgNVBAYTAlVTMRYwFAYDVQQKEw1MZXQncyBFbmNyeXB0MSMwIQYDVQQD\r\n" "MSQwIgYDVQQKExtEaWdpdGFsIFNpZ25hdHVyZSBUcnVzdCBDby4xFzAVBgNVBAMT\r\n"
"ExpMZXQncyBFbmNyeXB0IEF1dGhvcml0eSBYMTAeFw0xNTEyMzAwNzQ0MDBaFw0x\r\n" "DkRTVCBSb290IENBIFgzMB4XDTE2MDMxNzE2NDA0NloXDTIxMDMxNzE2NDA0Nlow\r\n"
"NjAzMjkwNzQ0MDBaMBwxGjAYBgNVBAMTEXd3dy5ob3dzbXlzc2wuY29tMIIBIjAN\r\n" "SjELMAkG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ICATE-----\r\n"; "-----END CERTIFICATE-----\r\n";

View file

@ -41,11 +41,11 @@
#include "mbedtls/error.h" #include "mbedtls/error.h"
#include "mbedtls/certs.h" #include "mbedtls/certs.h"
#define WEB_SERVER "howsmyssl.com" #define WEB_SERVER "www.howsmyssl.com"
#define WEB_PORT "443" #define WEB_PORT "443"
#define WEB_URL "https://www.howsmyssl.com/a/check" #define WEB_URL "https://www.howsmyssl.com/a/check"
#define GET_REQUEST "GET "WEB_URL" HTTP/1.1\n\n" #define GET_REQUEST "GET "WEB_URL" HTTP/1.1\nHost: "WEB_SERVER"\n\n"
/* Root cert for howsmyssl.com, stored in cert.c */ /* Root cert for howsmyssl.com, stored in cert.c */
extern const char *server_root_cert; extern const char *server_root_cert;