/* tasmota_ca.ino - Certificate authorities for Tasmota, LetsEncrypt and AWS Copyright (C) 2021 Theo Arends This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program. If not, see . */ // // Certificates are stored in flash (PROGMEM) to avoid consuming valuable RAM. // // To save space in flash, the Let's Encrypt and Amazon AWS certificates may be // individually omitted if TLS is enabled, but the certificates are not used. // This is typically the case when a locally generated root certificate is used // for TLS authentication. // // To omit these certificates, define one or both of the // OMIT_LETS_ENCRYPT_CERT and/or OMIT_AWS_CERT macros in user_config_override.h. // // To include a locally generated root certificate, define the // INCLUDE_LOCAL_CERT macro in user_config_override.h. // // See the files tasmota/local_ca_data_sample.h and tasmota/local_ca_descriptor_sample.h // in the Tasmota source for instructions for generating them from a local root // certificate in .crt format. // // Note: Using full certificate verification increases the amount of time // required to create a TLS connection, compared to fingerprint validation. // #if defined(USE_TLS) #if ! defined(OMIT_LETS_ENCRYPT_CERT) /*********************************************************************************************\ * LetsEncrypt ISRG Root X1 certificate, RSA 4096 bits SHA 256, valid until 20350604 * * https://letsencrypt.org/certificates/ * Downloaded from https://letsencrypt.org/certs/isrgrootx1.pem * * to convert do: `bearssl ta isrgrootx1.pem` * then copy and paste below, chain the generic names to the same as below * remove "static" and add "PROGMEM" \*********************************************************************************************/ static const unsigned char PROGMEM LetsEncrypt_ISRG_Root_X1_DN[] = { 0x30, 0x4F, 0x31, 0x0B, 0x30, 0x09, 0x06, 0x03, 0x55, 0x04, 0x06, 0x13, 0x02, 0x55, 0x53, 0x31, 0x29, 0x30, 0x27, 0x06, 0x03, 0x55, 0x04, 0x0A, 0x13, 0x20, 0x49, 0x6E, 0x74, 0x65, 0x72, 0x6E, 0x65, 0x74, 0x20, 0x53, 0x65, 0x63, 0x75, 0x72, 0x69, 0x74, 0x79, 0x20, 0x52, 0x65, 0x73, 0x65, 0x61, 0x72, 0x63, 0x68, 0x20, 0x47, 0x72, 0x6F, 0x75, 0x70, 0x31, 0x15, 0x30, 0x13, 0x06, 0x03, 0x55, 0x04, 0x03, 0x13, 0x0C, 0x49, 0x53, 0x52, 0x47, 0x20, 0x52, 0x6F, 0x6F, 0x74, 0x20, 0x58, 0x31 }; static const unsigned char PROGMEM LetsEncrypt_ISRG_Root_X1_RSA_N[] = { 0xAD, 0xE8, 0x24, 0x73, 0xF4, 0x14, 0x37, 0xF3, 0x9B, 0x9E, 0x2B, 0x57, 0x28, 0x1C, 0x87, 0xBE, 0xDC, 0xB7, 0xDF, 0x38, 0x90, 0x8C, 0x6E, 0x3C, 0xE6, 0x57, 0xA0, 0x78, 0xF7, 0x75, 0xC2, 0xA2, 0xFE, 0xF5, 0x6A, 0x6E, 0xF6, 0x00, 0x4F, 0x28, 0xDB, 0xDE, 0x68, 0x86, 0x6C, 0x44, 0x93, 0xB6, 0xB1, 0x63, 0xFD, 0x14, 0x12, 0x6B, 0xBF, 0x1F, 0xD2, 0xEA, 0x31, 0x9B, 0x21, 0x7E, 0xD1, 0x33, 0x3C, 0xBA, 0x48, 0xF5, 0xDD, 0x79, 0xDF, 0xB3, 0xB8, 0xFF, 0x12, 0xF1, 0x21, 0x9A, 0x4B, 0xC1, 0x8A, 0x86, 0x71, 0x69, 0x4A, 0x66, 0x66, 0x6C, 0x8F, 0x7E, 0x3C, 0x70, 0xBF, 0xAD, 0x29, 0x22, 0x06, 0xF3, 0xE4, 0xC0, 0xE6, 0x80, 0xAE, 0xE2, 0x4B, 0x8F, 0xB7, 0x99, 0x7E, 0x94, 0x03, 0x9F, 0xD3, 0x47, 0x97, 0x7C, 0x99, 0x48, 0x23, 0x53, 0xE8, 0x38, 0xAE, 0x4F, 0x0A, 0x6F, 0x83, 0x2E, 0xD1, 0x49, 0x57, 0x8C, 0x80, 0x74, 0xB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0xC6, 0xDD, 0x27, 0x51, 0x6E, 0xFF, 0xBC, 0x64, 0xF5, 0x33, 0x43, 0x4F }; static const unsigned char LetsEncrypt_ISRG_Root_X1_RSA_E[] = { 0x01, 0x00, 0x01 }; #endif #if ! defined(OMIT_AWS_CERT) /*********************************************************************************************\ * Amazon Root CA, RSA 2048 bits SHA 256, valid until 20380117 * * https://www.amazontrust.com/repository/ * Downloaded from https://www.amazontrust.com/repository/AmazonRootCA1.pem * * to convert do: "bearssl ta AmazonRootCA1.pem" * then copy and paste below, chain the generic names to the same as below * remove "static" and add "PROGMEM" \*********************************************************************************************/ const unsigned char PROGMEM AmazonRootCA1_DN[] = { 0x30, 0x39, 0x31, 0x0B, 0x30, 0x09, 0x06, 0x03, 0x55, 0x04, 0x06, 0x13, 0x02, 0x55, 0x53, 0x31, 0x0F, 0x30, 0x0D, 0x06, 0x03, 0x55, 0x04, 0x0A, 0x13, 0x06, 0x41, 0x6D, 0x61, 0x7A, 0x6F, 0x6E, 0x31, 0x19, 0x30, 0x17, 0x06, 0x03, 0x55, 0x04, 0x03, 0x13, 0x10, 0x41, 0x6D, 0x61, 0x7A, 0x6F, 0x6E, 0x20, 0x52, 0x6F, 0x6F, 0x74, 0x20, 0x43, 0x41, 0x20, 0x31 }; const unsigned char PROGMEM AmazonRootCA1_RSA_N[] = { 0xB2, 0x78, 0x80, 0x71, 0xCA, 0x78, 0xD5, 0xE3, 0x71, 0xAF, 0x47, 0x80, 0x50, 0x74, 0x7D, 0x6E, 0xD8, 0xD7, 0x88, 0x76, 0xF4, 0x99, 0x68, 0xF7, 0x58, 0x21, 0x60, 0xF9, 0x74, 0x84, 0x01, 0x2F, 0xAC, 0x02, 0x2D, 0x86, 0xD3, 0xA0, 0x43, 0x7A, 0x4E, 0xB2, 0xA4, 0xD0, 0x36, 0xBA, 0x01, 0xBE, 0x8D, 0xDB, 0x48, 0xC8, 0x07, 0x17, 0x36, 0x4C, 0xF4, 0xEE, 0x88, 0x23, 0xC7, 0x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, 0x3B, 0x24, 0x26, 0x8E, 0x04, 0xAE, 0x6C, 0x9A, 0xC8, 0xAA, 0x0D }; static const unsigned char PROGMEM AmazonRootCA1_RSA_E[] = { 0x01, 0x00, 0x01 }; #endif #if defined(INCLUDE_LOCAL_CERT) #include #endif // // ========== cumulative CA ================= // const br_x509_trust_anchor PROGMEM Tasmota_TA[] = { #if ! defined(OMIT_LETS_ENCRYPT_CERT) { { (unsigned char *)LetsEncrypt_ISRG_Root_X1_DN, sizeof LetsEncrypt_ISRG_Root_X1_DN }, BR_X509_TA_CA, { BR_KEYTYPE_RSA, { .rsa = { (unsigned char *)LetsEncrypt_ISRG_Root_X1_RSA_N, sizeof LetsEncrypt_ISRG_Root_X1_RSA_N, (unsigned char *)LetsEncrypt_ISRG_Root_X1_RSA_E, sizeof LetsEncrypt_ISRG_Root_X1_RSA_E, } } } } #if ! defined(OMIT_AWS_CERT) || defined(INCLUDE_LOCAL_CERT) , #endif #endif #if ! defined(OMIT_AWS_CERT) { { (unsigned char *)AmazonRootCA1_DN, sizeof AmazonRootCA1_DN }, BR_X509_TA_CA, { BR_KEYTYPE_RSA, { .rsa = { (unsigned char *)AmazonRootCA1_RSA_N, sizeof AmazonRootCA1_RSA_N, (unsigned char *)AmazonRootCA1_RSA_E, sizeof AmazonRootCA1_RSA_E, } } } } #if defined(INCLUDE_LOCAL_CERT) , #endif #endif #if defined(INCLUDE_LOCAL_CERT) #include #endif }; const size_t Tasmota_TA_size = nitems(Tasmota_TA); // #if defined(USE_TELEGRAM) // // we add a separate CA for telegram // /*********************************************************************************************\ // * Go Daddy Root Certificate Authority - G2, RSA 2048 bits SHA 256, valid until 20310503 // * // * to convert do: "brssl ta GoDaddyCA.pem" // * then copy and paste below, chain the generic names to the same as below // * remove "static" and add "PROGMEM" // \*********************************************************************************************/ // const unsigned char PROGMEM GoDaddyCAG2_DN[] = { // 0x30, 0x81, 0xB4, 0x31, 0x0B, 0x30, 0x09, 0x06, 0x03, 0x55, 0x04, 0x06, // 0x13, 0x02, 0x55, 0x53, 0x31, 0x10, 0x30, 0x0E, 0x06, 0x03, 0x55, 0x04, // 0x08, 0x13, 0x07, 0x41, 0x72, 0x69, 0x7A, 0x6F, 0x6E, 0x61, 0x31, 0x13, // 0x30, 0x11, 0x06, 0x03, 0x55, 0x04, 0x07, 0x13, 0x0A, 0x53, 0x63, 0x6F, // 0x74, 0x74, 0x73, 0x64, 0x61, 0x6C, 0x65, 0x31, 0x1A, 0x30, 0x18, 0x06, // 0x03, 0x55, 0x04, 0x0A, 0x13, 0x11, 0x47, 0x6F, 0x44, 0x61, 0x64, 0x64, // 0x79, 0x2E, 0x63, 0x6F, 0x6D, 0x2C, 0x20, 0x49, 0x6E, 0x63, 0x2E, 0x31, // 0x2D, 0x30, 0x2B, 0x06, 0x03, 0x55, 0x04, 0x0B, 0x13, 0x24, 0x68, 0x74, // 0x74, 0x70, 0x3A, 0x2F, 0x2F, 0x63, 0x65, 0x72, 0x74, 0x73, 0x2E, 0x67, // 0x6F, 0x64, 0x61, 0x64, 0x64, 0x79, 0x2E, 0x63, 0x6F, 0x6D, 0x2F, 0x72, // 0x65, 0x70, 0x6F, 0x73, 0x69, 0x74, 0x6F, 0x72, 0x79, 0x2F, 0x31, 0x33, // 0x30, 0x31, 0x06, 0x03, 0x55, 0x04, 0x03, 0x13, 0x2A, 0x47, 0x6F, 0x20, // 0x44, 0x61, 0x64, 0x64, 0x79, 0x20, 0x53, 0x65, 0x63, 0x75, 0x72, 0x65, // 0x20, 0x43, 0x65, 0x72, 0x74, 0x69, 0x66, 0x69, 0x63, 0x61, 0x74, 0x65, // 0x20, 0x41, 0x75, 0x74, 0x68, 0x6F, 0x72, 0x69, 0x74, 0x79, 0x20, 0x2D, // 0x20, 0x47, 0x32 // }; // const unsigned char PROGMEM GoDaddyCAG2_RSA_N[] = { // 0xB9, 0xE0, 0xCB, 0x10, 0xD4, 0xAF, 0x76, 0xBD, 0xD4, 0x93, 0x62, 0xEB, // 0x30, 0x64, 0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 0xF8, 0xB8, 0xBD, 0xE9, 0x32, 0x0A, 0x02, 0x94, 0x64, 0xC4, // 0x16, 0x3A, 0x50, 0xF1, 0x4A, 0xAE, 0xE7, 0x79, 0x33, 0xAF, 0x0C, 0x20, // 0x07, 0x7F, 0xE8, 0xDF, 0x04, 0x39, 0xC2, 0x69, 0x02, 0x6C, 0x63, 0x52, // 0xFA, 0x77, 0xC1, 0x1B, 0xC8, 0x74, 0x87, 0xC8, 0xB9, 0x93, 0x18, 0x50, // 0x54, 0x35, 0x4B, 0x69, 0x4E, 0xBC, 0x3B, 0xD3, 0x49, 0x2E, 0x1F, 0xDC, // 0xC1, 0xD2, 0x52, 0xFB // }; // const unsigned char PROGMEM GoDaddyCAG2_RSA_E[] = { // 0x01, 0x00, 0x01 // }; // const br_x509_trust_anchor PROGMEM GoDaddyCAG2_TA = { // { (unsigned char *)GoDaddyCAG2_DN, sizeof GoDaddyCAG2_DN }, // 0, // { // BR_KEYTYPE_RSA, // { .rsa = { // (unsigned char *)GoDaddyCAG2_RSA_N, sizeof GoDaddyCAG2_RSA_N, // (unsigned char *)GoDaddyCAG2_RSA_E, sizeof GoDaddyCAG2_RSA_E, // } } // } // }; // #endif #endif // defined(USE_TLS)