This is the new MiniTLS Program which build the connection with the website httpbin.org. The time of the program will last only for one year

Dependencies:   EthernetInterface newMiniTLS-GPL NewMiniTLS-HTTPSClient__Jacobshi mbed-rtos mbed

Fork of MiniTLS-HTTPS-Example by Donatien Garnier

Committer:
MiniTLS
Date:
Thu Aug 28 13:20:21 2014 +0000
Revision:
1:4a6e2b2faca6
Parent:
0:60de3ce23ca9
Child:
2:9473c5066a2e
Updated to new mbed.org certificate

Who changed what in which revision?

UserRevisionLine numberNew contents of line
MiniTLS 0:60de3ce23ca9 1 #include "mbed.h"
MiniTLS 0:60de3ce23ca9 2 #include "EthernetInterface.h"
MiniTLS 0:60de3ce23ca9 3 #include "HTTPClient.h"
MiniTLS 0:60de3ce23ca9 4 #include "MiniTLS-GPL/cpp/MiniTLS.h"
MiniTLS 0:60de3ce23ca9 5
MiniTLS 0:60de3ce23ca9 6 MiniTLS miniTLS;
MiniTLS 0:60de3ce23ca9 7 EthernetInterface eth;
MiniTLS 0:60de3ce23ca9 8 HTTPClient http;
MiniTLS 0:60de3ce23ca9 9 char str[512];
MiniTLS 0:60de3ce23ca9 10
MiniTLS 0:60de3ce23ca9 11 const uint8_t pub_key[] = {
MiniTLS 1:4a6e2b2faca6 12 /*0x30,0x82,0x01,0x22,0x30,0x0D,0x06,0x09,0x2A,0x86,0x48,0x86,0xF7,0x0D,0x01,0x01,
MiniTLS 1:4a6e2b2faca6 13 0x01,0x05,0x00,0x03,0x82,0x01,0x0F,0x00,*/0x30,0x82,0x01,0x0A,0x02,0x82,0x01,0x01,
MiniTLS 1:4a6e2b2faca6 14 0x00,0xEC,0x4F,0x55,0x0A,0xD8,0xB1,0x6D,0xA1,0xB1,0x9F,0x1C,0xD8,0x93,0xE9,0x64,
MiniTLS 1:4a6e2b2faca6 15 0x64,0x77,0x14,0x28,0x53,0x70,0xD6,0x4F,0xCF,0x99,0x3A,0x38,0x36,0xF9,0x7B,0x77,
MiniTLS 1:4a6e2b2faca6 16 0xAB,0x0C,0x1D,0xE0,0x5B,0x55,0x93,0x09,0x34,0x31,0x8A,0x98,0xF0,0x98,0xB8,0x29,
MiniTLS 1:4a6e2b2faca6 17 0xC2,0xF8,0x1E,0xFF,0xD8,0x8F,0xD5,0x91,0x4C,0xD6,0x32,0xF2,0x67,0x33,0x79,0xF4,
MiniTLS 1:4a6e2b2faca6 18 0x4E,0x92,0xD8,0x75,0xD3,0x2F,0xD3,0xB6,0xB5,0x3E,0xB9,0xFB,0x48,0xF9,0xCB,0x04,
MiniTLS 1:4a6e2b2faca6 19 0x50,0xC0,0xB0,0x54,0x00,0x85,0xE6,0x35,0x0B,0x0C,0x8C,0x76,0x01,0x86,0x6D,0xA3,
MiniTLS 1:4a6e2b2faca6 20 0x3A,0xCD,0xF4,0x67,0xF4,0x2A,0x1D,0x80,0xE6,0xF5,0x43,0xA8,0x05,0x6B,0x2E,0xA8,
MiniTLS 1:4a6e2b2faca6 21 0x22,0x21,0xA6,0xA6,0xE0,0x0D,0x96,0x2D,0x10,0x75,0x11,0x57,0xE8,0x23,0xEC,0x8E,
MiniTLS 1:4a6e2b2faca6 22 0x1E,0xAD,0x3C,0x26,0xC4,0x57,0x9F,0xE5,0x33,0x3D,0x66,0xF4,0x12,0x6F,0xFF,0x10,
MiniTLS 1:4a6e2b2faca6 23 0x87,0xBC,0xCF,0x4D,0xFB,0xF9,0xF1,0xF4,0x8D,0x78,0x1A,0x49,0x7F,0xFB,0x8F,0x3C,
MiniTLS 1:4a6e2b2faca6 24 0x6E,0x3E,0x4F,0xDD,0x0A,0xF6,0xC2,0x5F,0xA6,0xDC,0x11,0x89,0xF5,0x10,0x7B,0x00,
MiniTLS 1:4a6e2b2faca6 25 0x1A,0x83,0x0B,0xDC,0xF5,0xAE,0x7A,0xB3,0x63,0xD3,0x97,0x71,0xD3,0x27,0x83,0x5D,
MiniTLS 1:4a6e2b2faca6 26 0xCA,0x7F,0x44,0x6C,0xDC,0x6F,0x46,0x3D,0x0E,0x6E,0x86,0x31,0xCB,0xF6,0x08,0x18,
MiniTLS 1:4a6e2b2faca6 27 0xD6,0x2E,0x45,0xCB,0x9E,0x93,0xCB,0x28,0xA6,0x11,0xE6,0x34,0x07,0x2E,0x06,0x26,
MiniTLS 1:4a6e2b2faca6 28 0x34,0xCC,0xD5,0xD2,0xAE,0x6C,0x91,0x1D,0x88,0xF3,0xD2,0xDF,0x7E,0x01,0x4E,0xA4,
MiniTLS 1:4a6e2b2faca6 29 0xBF,0x2F,0x7B,0x5B,0xAB,0xB7,0xFA,0xDE,0x7A,0xE9,0x0B,0x6F,0x8D,0x63,0x14,0x70,
MiniTLS 1:4a6e2b2faca6 30 0x17,0x02,0x03,0x01,0x00,0x01,
MiniTLS 0:60de3ce23ca9 31 };
MiniTLS 0:60de3ce23ca9 32
MiniTLS 0:60de3ce23ca9 33 const uint8_t certificate[] = {
MiniTLS 1:4a6e2b2faca6 34 0x30,0x82,0x04,0xE7,0x30,0x82,0x03,0xCF,0xA0,0x03,0x02,0x01,0x02,0x02,0x10,0x4D,
MiniTLS 1:4a6e2b2faca6 35 0x1E,0x6C,0xAF,0x88,0xBD,0xDE,0xD5,0x8A,0x3F,0x99,0x1A,0x76,0x86,0xF0,0xF9,0x30,
MiniTLS 1:4a6e2b2faca6 36 0x0D,0x06,0x09,0x2A,0x86,0x48,0x86,0xF7,0x0D,0x01,0x01,0x0B,0x05,0x00,0x30,0x7E,
MiniTLS 1:4a6e2b2faca6 37 0x31,0x0B,0x30,0x09,0x06,0x03,0x55,0x04,0x06,0x13,0x02,0x55,0x53,0x31,0x1D,0x30,
MiniTLS 1:4a6e2b2faca6 38 0x1B,0x06,0x03,0x55,0x04,0x0A,0x13,0x14,0x53,0x79,0x6D,0x61,0x6E,0x74,0x65,0x63,
MiniTLS 1:4a6e2b2faca6 39 0x20,0x43,0x6F,0x72,0x70,0x6F,0x72,0x61,0x74,0x69,0x6F,0x6E,0x31,0x1F,0x30,0x1D,
MiniTLS 1:4a6e2b2faca6 40 0x06,0x03,0x55,0x04,0x0B,0x13,0x16,0x53,0x79,0x6D,0x61,0x6E,0x74,0x65,0x63,0x20,
MiniTLS 1:4a6e2b2faca6 41 0x54,0x72,0x75,0x73,0x74,0x20,0x4E,0x65,0x74,0x77,0x6F,0x72,0x6B,0x31,0x2F,0x30,
MiniTLS 1:4a6e2b2faca6 42 0x2D,0x06,0x03,0x55,0x04,0x03,0x13,0x26,0x53,0x79,0x6D,0x61,0x6E,0x74,0x65,0x63,
MiniTLS 1:4a6e2b2faca6 43 0x20,0x43,0x6C,0x61,0x73,0x73,0x20,0x33,0x20,0x53,0x65,0x63,0x75,0x72,0x65,0x20,
MiniTLS 1:4a6e2b2faca6 44 0x53,0x65,0x72,0x76,0x65,0x72,0x20,0x43,0x41,0x20,0x2D,0x20,0x47,0x34,0x30,0x1E,
MiniTLS 1:4a6e2b2faca6 45 0x17,0x0D,0x31,0x34,0x30,0x37,0x31,0x37,0x30,0x30,0x30,0x30,0x30,0x30,0x5A,0x17,
MiniTLS 1:4a6e2b2faca6 46 0x0D,0x31,0x35,0x30,0x37,0x32,0x36,0x32,0x33,0x35,0x39,0x35,0x39,0x5A,0x30,0x6E,
MiniTLS 1:4a6e2b2faca6 47 0x31,0x0B,0x30,0x09,0x06,0x03,0x55,0x04,0x06,0x13,0x02,0x47,0x42,0x31,0x17,0x30,
MiniTLS 1:4a6e2b2faca6 48 0x15,0x06,0x03,0x55,0x04,0x08,0x0C,0x0E,0x43,0x61,0x6D,0x62,0x72,0x69,0x64,0x67,
MiniTLS 1:4a6e2b2faca6 49 0x65,0x73,0x68,0x69,0x72,0x65,0x31,0x12,0x30,0x10,0x06,0x03,0x55,0x04,0x07,0x0C,
MiniTLS 1:4a6e2b2faca6 50 0x09,0x43,0x61,0x6D,0x62,0x72,0x69,0x64,0x67,0x65,0x31,0x10,0x30,0x0E,0x06,0x03,
MiniTLS 1:4a6e2b2faca6 51 0x55,0x04,0x0A,0x0C,0x07,0x41,0x52,0x4D,0x20,0x4C,0x74,0x64,0x31,0x0D,0x30,0x0B,
MiniTLS 1:4a6e2b2faca6 52 0x06,0x03,0x55,0x04,0x0B,0x0C,0x04,0x41,0x44,0x49,0x54,0x31,0x11,0x30,0x0F,0x06,
MiniTLS 1:4a6e2b2faca6 53 0x03,0x55,0x04,0x03,0x0C,0x08,0x6D,0x62,0x65,0x64,0x2E,0x6F,0x72,0x67,0x30,0x82,
MiniTLS 1:4a6e2b2faca6 54 0x01,0x22,0x30,0x0D,0x06,0x09,0x2A,0x86,0x48,0x86,0xF7,0x0D,0x01,0x01,0x01,0x05,
MiniTLS 1:4a6e2b2faca6 55 0x00,0x03,0x82,0x01,0x0F,0x00,0x30,0x82,0x01,0x0A,0x02,0x82,0x01,0x01,0x00,0xEC,
MiniTLS 1:4a6e2b2faca6 56 0x4F,0x55,0x0A,0xD8,0xB1,0x6D,0xA1,0xB1,0x9F,0x1C,0xD8,0x93,0xE9,0x64,0x64,0x77,
MiniTLS 1:4a6e2b2faca6 57 0x14,0x28,0x53,0x70,0xD6,0x4F,0xCF,0x99,0x3A,0x38,0x36,0xF9,0x7B,0x77,0xAB,0x0C,
MiniTLS 1:4a6e2b2faca6 58 0x1D,0xE0,0x5B,0x55,0x93,0x09,0x34,0x31,0x8A,0x98,0xF0,0x98,0xB8,0x29,0xC2,0xF8,
MiniTLS 1:4a6e2b2faca6 59 0x1E,0xFF,0xD8,0x8F,0xD5,0x91,0x4C,0xD6,0x32,0xF2,0x67,0x33,0x79,0xF4,0x4E,0x92,
MiniTLS 1:4a6e2b2faca6 60 0xD8,0x75,0xD3,0x2F,0xD3,0xB6,0xB5,0x3E,0xB9,0xFB,0x48,0xF9,0xCB,0x04,0x50,0xC0,
MiniTLS 1:4a6e2b2faca6 61 0xB0,0x54,0x00,0x85,0xE6,0x35,0x0B,0x0C,0x8C,0x76,0x01,0x86,0x6D,0xA3,0x3A,0xCD,
MiniTLS 1:4a6e2b2faca6 62 0xF4,0x67,0xF4,0x2A,0x1D,0x80,0xE6,0xF5,0x43,0xA8,0x05,0x6B,0x2E,0xA8,0x22,0x21,
MiniTLS 1:4a6e2b2faca6 63 0xA6,0xA6,0xE0,0x0D,0x96,0x2D,0x10,0x75,0x11,0x57,0xE8,0x23,0xEC,0x8E,0x1E,0xAD,
MiniTLS 1:4a6e2b2faca6 64 0x3C,0x26,0xC4,0x57,0x9F,0xE5,0x33,0x3D,0x66,0xF4,0x12,0x6F,0xFF,0x10,0x87,0xBC,
MiniTLS 1:4a6e2b2faca6 65 0xCF,0x4D,0xFB,0xF9,0xF1,0xF4,0x8D,0x78,0x1A,0x49,0x7F,0xFB,0x8F,0x3C,0x6E,0x3E,
MiniTLS 1:4a6e2b2faca6 66 0x4F,0xDD,0x0A,0xF6,0xC2,0x5F,0xA6,0xDC,0x11,0x89,0xF5,0x10,0x7B,0x00,0x1A,0x83,
MiniTLS 1:4a6e2b2faca6 67 0x0B,0xDC,0xF5,0xAE,0x7A,0xB3,0x63,0xD3,0x97,0x71,0xD3,0x27,0x83,0x5D,0xCA,0x7F,
MiniTLS 1:4a6e2b2faca6 68 0x44,0x6C,0xDC,0x6F,0x46,0x3D,0x0E,0x6E,0x86,0x31,0xCB,0xF6,0x08,0x18,0xD6,0x2E,
MiniTLS 1:4a6e2b2faca6 69 0x45,0xCB,0x9E,0x93,0xCB,0x28,0xA6,0x11,0xE6,0x34,0x07,0x2E,0x06,0x26,0x34,0xCC,
MiniTLS 1:4a6e2b2faca6 70 0xD5,0xD2,0xAE,0x6C,0x91,0x1D,0x88,0xF3,0xD2,0xDF,0x7E,0x01,0x4E,0xA4,0xBF,0x2F,
MiniTLS 1:4a6e2b2faca6 71 0x7B,0x5B,0xAB,0xB7,0xFA,0xDE,0x7A,0xE9,0x0B,0x6F,0x8D,0x63,0x14,0x70,0x17,0x02,
MiniTLS 1:4a6e2b2faca6 72 0x03,0x01,0x00,0x01,0xA3,0x82,0x01,0x6F,0x30,0x82,0x01,0x6B,0x30,0x21,0x06,0x03,
MiniTLS 1:4a6e2b2faca6 73 0x55,0x1D,0x11,0x04,0x1A,0x30,0x18,0x82,0x0C,0x63,0x64,0x6E,0x2E,0x6D,0x62,0x65,
MiniTLS 1:4a6e2b2faca6 74 0x64,0x2E,0x6F,0x72,0x67,0x82,0x08,0x6D,0x62,0x65,0x64,0x2E,0x6F,0x72,0x67,0x30,
MiniTLS 1:4a6e2b2faca6 75 0x09,0x06,0x03,0x55,0x1D,0x13,0x04,0x02,0x30,0x00,0x30,0x0E,0x06,0x03,0x55,0x1D,
MiniTLS 1:4a6e2b2faca6 76 0x0F,0x01,0x01,0xFF,0x04,0x04,0x03,0x02,0x05,0xA0,0x30,0x1D,0x06,0x03,0x55,0x1D,
MiniTLS 1:4a6e2b2faca6 77 0x25,0x04,0x16,0x30,0x14,0x06,0x08,0x2B,0x06,0x01,0x05,0x05,0x07,0x03,0x01,0x06,
MiniTLS 1:4a6e2b2faca6 78 0x08,0x2B,0x06,0x01,0x05,0x05,0x07,0x03,0x02,0x30,0x65,0x06,0x03,0x55,0x1D,0x20,
MiniTLS 1:4a6e2b2faca6 79 0x04,0x5E,0x30,0x5C,0x30,0x5A,0x06,0x0A,0x60,0x86,0x48,0x01,0x86,0xF8,0x45,0x01,
MiniTLS 1:4a6e2b2faca6 80 0x07,0x36,0x30,0x4C,0x30,0x23,0x06,0x08,0x2B,0x06,0x01,0x05,0x05,0x07,0x02,0x01,
MiniTLS 1:4a6e2b2faca6 81 0x16,0x17,0x68,0x74,0x74,0x70,0x73,0x3A,0x2F,0x2F,0x64,0x2E,0x73,0x79,0x6D,0x63,
MiniTLS 1:4a6e2b2faca6 82 0x62,0x2E,0x63,0x6F,0x6D,0x2F,0x63,0x70,0x73,0x30,0x25,0x06,0x08,0x2B,0x06,0x01,
MiniTLS 1:4a6e2b2faca6 83 0x05,0x05,0x07,0x02,0x02,0x30,0x19,0x1A,0x17,0x68,0x74,0x74,0x70,0x73,0x3A,0x2F,
MiniTLS 1:4a6e2b2faca6 84 0x2F,0x64,0x2E,0x73,0x79,0x6D,0x63,0x62,0x2E,0x63,0x6F,0x6D,0x2F,0x72,0x70,0x61,
MiniTLS 1:4a6e2b2faca6 85 0x30,0x1F,0x06,0x03,0x55,0x1D,0x23,0x04,0x18,0x30,0x16,0x80,0x14,0x5F,0x60,0xCF,
MiniTLS 1:4a6e2b2faca6 86 0x61,0x90,0x55,0xDF,0x84,0x43,0x14,0x8A,0x60,0x2A,0xB2,0xF5,0x7A,0xF4,0x43,0x18,
MiniTLS 1:4a6e2b2faca6 87 0xEF,0x30,0x2B,0x06,0x03,0x55,0x1D,0x1F,0x04,0x24,0x30,0x22,0x30,0x20,0xA0,0x1E,
MiniTLS 1:4a6e2b2faca6 88 0xA0,0x1C,0x86,0x1A,0x68,0x74,0x74,0x70,0x3A,0x2F,0x2F,0x73,0x73,0x2E,0x73,0x79,
MiniTLS 1:4a6e2b2faca6 89 0x6D,0x63,0x62,0x2E,0x63,0x6F,0x6D,0x2F,0x73,0x73,0x2E,0x63,0x72,0x6C,0x30,0x57,
MiniTLS 1:4a6e2b2faca6 90 0x06,0x08,0x2B,0x06,0x01,0x05,0x05,0x07,0x01,0x01,0x04,0x4B,0x30,0x49,0x30,0x1F,
MiniTLS 1:4a6e2b2faca6 91 0x06,0x08,0x2B,0x06,0x01,0x05,0x05,0x07,0x30,0x01,0x86,0x13,0x68,0x74,0x74,0x70,
MiniTLS 1:4a6e2b2faca6 92 0x3A,0x2F,0x2F,0x73,0x73,0x2E,0x73,0x79,0x6D,0x63,0x64,0x2E,0x63,0x6F,0x6D,0x30,
MiniTLS 1:4a6e2b2faca6 93 0x26,0x06,0x08,0x2B,0x06,0x01,0x05,0x05,0x07,0x30,0x02,0x86,0x1A,0x68,0x74,0x74,
MiniTLS 1:4a6e2b2faca6 94 0x70,0x3A,0x2F,0x2F,0x73,0x73,0x2E,0x73,0x79,0x6D,0x63,0x62,0x2E,0x63,0x6F,0x6D,
MiniTLS 1:4a6e2b2faca6 95 0x2F,0x73,0x73,0x2E,0x63,0x72,0x74,0x30,0x0D,0x06,0x09,0x2A,0x86,0x48,0x86,0xF7,
MiniTLS 1:4a6e2b2faca6 96 0x0D,0x01,0x01,0x0B,0x05,0x00,0x03,0x82,0x01,0x01,0x00,0x69,0x9E,0x08,0xE2,0x75,
MiniTLS 1:4a6e2b2faca6 97 0x5D,0xA5,0xE2,0x29,0x8C,0xB6,0xA7,0xF0,0x6C,0x30,0x16,0x51,0x24,0x5B,0x76,0x20,
MiniTLS 1:4a6e2b2faca6 98 0xCD,0x4F,0xB1,0x26,0xFE,0x01,0x35,0x73,0x7F,0xFF,0x12,0x1B,0x94,0xF5,0x37,0x81,
MiniTLS 1:4a6e2b2faca6 99 0x85,0xBF,0x3D,0x44,0xBC,0x06,0x47,0x1C,0x95,0x56,0x52,0xA1,0x17,0xB4,0x22,0xA1,
MiniTLS 1:4a6e2b2faca6 100 0x5F,0xB6,0xA1,0xC8,0x38,0xB1,0x16,0x39,0xE1,0x14,0x82,0xF9,0xF6,0x00,0x58,0xF4,
MiniTLS 1:4a6e2b2faca6 101 0x62,0x39,0x0E,0xA3,0x08,0x59,0x11,0x62,0xD7,0xEA,0x06,0xC7,0x34,0x92,0xEB,0x1B,
MiniTLS 1:4a6e2b2faca6 102 0x01,0xC6,0x80,0x09,0x91,0x03,0xB0,0x51,0x7B,0x2E,0x68,0x7A,0xBA,0xF0,0x51,0x30,
MiniTLS 1:4a6e2b2faca6 103 0x68,0x28,0xA0,0xEB,0xD9,0xB2,0x9E,0xD1,0x2A,0x75,0xD5,0x78,0x9B,0x3E,0xC9,0xD7,
MiniTLS 1:4a6e2b2faca6 104 0xBE,0x59,0xEB,0xA6,0xF6,0xA4,0x5C,0xCE,0x6A,0x5A,0xCC,0xD1,0x68,0x13,0xE8,0xC2,
MiniTLS 1:4a6e2b2faca6 105 0xC2,0xAF,0x85,0x30,0x27,0x44,0xE0,0x5F,0x15,0x0F,0xCC,0xD1,0xC5,0x3C,0x10,0x34,
MiniTLS 1:4a6e2b2faca6 106 0x51,0x6F,0x94,0x56,0x39,0x85,0x15,0x48,0xC1,0xCA,0x68,0x49,0x4E,0x89,0xD5,0x39,
MiniTLS 1:4a6e2b2faca6 107 0xE8,0x68,0x1F,0xBC,0x0A,0x5F,0x30,0x2C,0xBC,0xED,0x61,0xB3,0x3A,0xF8,0xE8,0xAB,
MiniTLS 1:4a6e2b2faca6 108 0x8E,0xC3,0x86,0xD5,0xA3,0xA7,0x41,0xB7,0x15,0xB4,0xC2,0xB5,0xC7,0x91,0x6A,0x7B,
MiniTLS 1:4a6e2b2faca6 109 0x84,0xE3,0xA5,0x3B,0x46,0x72,0x01,0xDB,0xBE,0x0E,0xD0,0x1E,0x05,0x36,0x57,0x8D,
MiniTLS 1:4a6e2b2faca6 110 0xE4,0x19,0x74,0xB6,0xC5,0xCA,0x10,0xEB,0x7A,0x39,0x8B,0xAE,0x28,0x99,0x67,0x72,
MiniTLS 1:4a6e2b2faca6 111 0x9D,0xEF,0x8F,0x78,0x5E,0xA8,0x6A,0x54,0x11,0xC8,0xCE,0xBD,0x84,0x5A,0x85,0x8C,
MiniTLS 1:4a6e2b2faca6 112 0xE2,0x6F,0xF9,0x79,0xCA,0x0D,0xA9,0xB4,0x20,0xCC,0xBD,
MiniTLS 1:4a6e2b2faca6 113 };
MiniTLS 1:4a6e2b2faca6 114
MiniTLS 0:60de3ce23ca9 115 int main()
MiniTLS 0:60de3ce23ca9 116 {
MiniTLS 0:60de3ce23ca9 117 Serial pc(USBTX, USBRX);
MiniTLS 0:60de3ce23ca9 118 pc.baud(115200);
MiniTLS 0:60de3ce23ca9 119
MiniTLS 0:60de3ce23ca9 120 miniTLS.init();
MiniTLS 0:60de3ce23ca9 121
MiniTLS 0:60de3ce23ca9 122 //Deterministic but this is an example!
MiniTLS 0:60de3ce23ca9 123 for(int i = 0; i < 32; i++)
MiniTLS 0:60de3ce23ca9 124 {
MiniTLS 0:60de3ce23ca9 125 uint32_t ticks = us_ticker_read();
MiniTLS 0:60de3ce23ca9 126 miniTLS.feedPRNG((uint8_t*)&ticks, sizeof(uint32_t));
MiniTLS 0:60de3ce23ca9 127 }
MiniTLS 0:60de3ce23ca9 128
MiniTLS 0:60de3ce23ca9 129 miniTLS.addCertificate(certificate, sizeof(certificate), pub_key, sizeof(pub_key));
MiniTLS 0:60de3ce23ca9 130
MiniTLS 0:60de3ce23ca9 131 eth.init(); //Use DHCP
MiniTLS 0:60de3ce23ca9 132
MiniTLS 0:60de3ce23ca9 133 int ret = eth.connect();
MiniTLS 0:60de3ce23ca9 134 if(ret)
MiniTLS 0:60de3ce23ca9 135 {
MiniTLS 0:60de3ce23ca9 136 printf("connect() returned %d\r\n", ret);
MiniTLS 0:60de3ce23ca9 137 }
MiniTLS 0:60de3ce23ca9 138
MiniTLS 0:60de3ce23ca9 139 //GET data
MiniTLS 0:60de3ce23ca9 140 printf("Trying to fetch page...\r\n");
MiniTLS 0:60de3ce23ca9 141 ret = http.get("https://mbed.org/media/uploads/donatien/hello.txt", str, 128);
MiniTLS 0:60de3ce23ca9 142 if (!ret)
MiniTLS 0:60de3ce23ca9 143 {
MiniTLS 0:60de3ce23ca9 144 printf("Page fetched successfully - read %d characters\r\n", strlen(str));
MiniTLS 0:60de3ce23ca9 145 printf("Result: %s\r\n", str);
MiniTLS 0:60de3ce23ca9 146 }
MiniTLS 0:60de3ce23ca9 147 else
MiniTLS 0:60de3ce23ca9 148 {
MiniTLS 0:60de3ce23ca9 149 printf("Error - ret = %d - HTTP return code = %d\r\n", ret, http.getHTTPResponseCode());
MiniTLS 0:60de3ce23ca9 150 }
MiniTLS 0:60de3ce23ca9 151
MiniTLS 0:60de3ce23ca9 152 eth.disconnect();
MiniTLS 0:60de3ce23ca9 153
MiniTLS 0:60de3ce23ca9 154 while(1) {
MiniTLS 0:60de3ce23ca9 155 }
MiniTLS 0:60de3ce23ca9 156 }