Skip to content

Commit

Permalink
Add updated scripts and certificates to the distribution.
Browse files Browse the repository at this point in the history
  • Loading branch information
Greg Landry committed Jun 3, 2024
1 parent 7cf50d9 commit af6cf4a
Show file tree
Hide file tree
Showing 19 changed files with 278 additions and 0 deletions.
13 changes: 13 additions & 0 deletions ClassCerts/AWEP/client_crt.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
/* TCP client certificate generated by OpenSSL */
#define CLIENT_CERTIFICATE_PEM \
"-----BEGIN CERTIFICATE-----\n"\
"MIIBgDCCASUCFGOgkvBxqw/AHJeyoh9136VI4ySCMAoGCCqGSM49BAMCMEIxCzAJ\n"\
"BgNVBAYTAlhYMRUwEwYDVQQHDAxEZWZhdWx0IENpdHkxHDAaBgNVBAoME0RlZmF1\n"\
"bHQgQ29tcGFueSBMdGQwHhcNMjQwMzA4MjAwMzA2WhcNMzQwMzA2MjAwMzA2WjBC\n"\
"MQswCQYDVQQGEwJYWDEVMBMGA1UEBwwMRGVmYXVsdCBDaXR5MRwwGgYDVQQKDBNE\n"\
"ZWZhdWx0IENvbXBhbnkgTHRkMFkwEwYHKoZIzj0CAQYIKoZIzj0DAQcDQgAE3esU\n"\
"SnUXeJJEeMXkJnBAYOZeoC8UMYotrrt+eyH8Eua3hDEgarNa4/ynPzMfMAchgrhl\n"\
"Fq4gT7F3yGFczTW5ezAKBggqhkjOPQQDAgNJADBGAiEA8gI9Ap5BTXsQSkkNJwkJ\n"\
"Oj91z70gjnF1sIxOBNKeSmYCIQD2Lv0/wne/t0Ome1U9hteDr+ClobGRr7UPFXx9\n"\
"6dI+wA==\n"\
"-----END CERTIFICATE-----\n"
7 changes: 7 additions & 0 deletions ClassCerts/AWEP/client_key.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
/* Private key of the TCP client generated by OpenSSL */
#define CLIENT_PRIVATE_KEY_PEM \
"-----BEGIN EC PRIVATE KEY-----\n"\
"MHcCAQEEIEBGIdEovAXfGF0NSXVk2edqcRByeF4KUJ8Pe/Qhxig9oAoGCCqGSM49\n"\
"AwEHoUQDQgAE3esUSnUXeJJEeMXkJnBAYOZeoC8UMYotrrt+eyH8Eua3hDEgarNa\n"\
"4/ynPzMfMAchgrhlFq4gT7F3yGFczTW5ew==\n"\
"-----END EC PRIVATE KEY-----\n"
14 changes: 14 additions & 0 deletions ClassCerts/AWEP/root_ca_crt.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
/* TCP server certificate generated by OpenSSL */
#define ROOTCA_PEM \
"-----BEGIN CERTIFICATE-----\n"\
"MIIB2DCCAX+gAwIBAgIUY/+5vDaHIb07T0rWQxL4uoZemJQwCgYIKoZIzj0EAwIw\n"\
"QjELMAkGA1UEBhMCWFgxFTATBgNVBAcMDERlZmF1bHQgQ2l0eTEcMBoGA1UECgwT\n"\
"RGVmYXVsdCBDb21wYW55IEx0ZDAeFw0yNDAzMDgxNzMyMTBaFw0zNDAzMDYxNzMy\n"\
"MTBaMEIxCzAJBgNVBAYTAlhYMRUwEwYDVQQHDAxEZWZhdWx0IENpdHkxHDAaBgNV\n"\
"BAoME0RlZmF1bHQgQ29tcGFueSBMdGQwWTATBgcqhkjOPQIBBggqhkjOPQMBBwNC\n"\
"AASMBNWVWPdwDhjNCE35vkjtX7/ZmK1RGUxLNbJwcWJZ7m7hxIKhkvmaBH5/SUG6\n"\
"t6KMgjVTIdPuE7HF+alB83w8o1MwUTAdBgNVHQ4EFgQUEWS7RXbR3ZVt5muYx6hg\n"\
"35yCNVMwHwYDVR0jBBgwFoAUEWS7RXbR3ZVt5muYx6hg35yCNVMwDwYDVR0TAQH/\n"\
"BAUwAwEB/zAKBggqhkjOPQQDAgNHADBEAiANaJ3WvcXDzkvulFF+x38CxiT+0LNZ\n"\
"em36ByPvoNGcIgIgFZY4NjvGIUi0itVoh7YnxyET6O4mVXAVt53AUAx7I3s=\n"\
"-----END CERTIFICATE-----\n"
13 changes: 13 additions & 0 deletions ClassCerts/AWEP/server_crt.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
/* TCP server certificate generated by OpenSSL */
#define SERVER_CERTIFICATE_PEM \
"-----BEGIN CERTIFICATE-----\n"\
"MIIBfzCCASUCFGOgkvBxqw/AHJeyoh9136VI4ySDMAoGCCqGSM49BAMCMEIxCzAJ\n"\
"BgNVBAYTAlhYMRUwEwYDVQQHDAxEZWZhdWx0IENpdHkxHDAaBgNVBAoME0RlZmF1\n"\
"bHQgQ29tcGFueSBMdGQwHhcNMjQwMzA4MjEwNzM3WhcNMzQwMzA2MjEwNzM3WjBC\n"\
"MQswCQYDVQQGEwJYWDEVMBMGA1UEBwwMRGVmYXVsdCBDaXR5MRwwGgYDVQQKDBNE\n"\
"ZWZhdWx0IENvbXBhbnkgTHRkMFkwEwYHKoZIzj0CAQYIKoZIzj0DAQcDQgAEcNIi\n"\
"KXt9FRegfYMHrQLYKhXNFJnDUP/94Ek/f0T0uC2a+isDfhWnYb6Waym4RF0/YzvC\n"\
"kwlbbTp7qNTvNTMCjTAKBggqhkjOPQQDAgNIADBFAiEAxLii8C6EtbR+Dr4zbkE5\n"\
"HIp/6qLhY/n+XqcI9yAWFn0CID0sW/O8jfMs9RhQdQ+lWPy35yc26KEIjMpd50R0\n"\
"vMFl\n"\
"-----END CERTIFICATE-----\n"
7 changes: 7 additions & 0 deletions ClassCerts/AWEP/server_key.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
/* Private key of the TCP Server generated by OpenSSL */
#define SERVER_PRIVATE_KEY_PEM \
"-----BEGIN EC PRIVATE KEY-----\n"\
"MHcCAQEEIMmEMlmaTHOF12k3/wzcalsX8ENSmdfJLXEP+8w6ljD2oAoGCCqGSM49\n"\
"AwEHoUQDQgAEcNIiKXt9FRegfYMHrQLYKhXNFJnDUP/94Ek/f0T0uC2a+isDfhWn\n"\
"Yb6Waym4RF0/YzvCkwlbbTp7qNTvNTMCjQ==\n"\
"-----END EC PRIVATE KEY-----\n"
13 changes: 13 additions & 0 deletions Projects/key_ch03b_ex01_client_secure/client_crt.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
/* TCP client certificate generated by OpenSSL */
#define CLIENT_CERTIFICATE_PEM \
"-----BEGIN CERTIFICATE-----\n"\
"MIIBgDCCASUCFGOgkvBxqw/AHJeyoh9136VI4ySCMAoGCCqGSM49BAMCMEIxCzAJ\n"\
"BgNVBAYTAlhYMRUwEwYDVQQHDAxEZWZhdWx0IENpdHkxHDAaBgNVBAoME0RlZmF1\n"\
"bHQgQ29tcGFueSBMdGQwHhcNMjQwMzA4MjAwMzA2WhcNMzQwMzA2MjAwMzA2WjBC\n"\
"MQswCQYDVQQGEwJYWDEVMBMGA1UEBwwMRGVmYXVsdCBDaXR5MRwwGgYDVQQKDBNE\n"\
"ZWZhdWx0IENvbXBhbnkgTHRkMFkwEwYHKoZIzj0CAQYIKoZIzj0DAQcDQgAE3esU\n"\
"SnUXeJJEeMXkJnBAYOZeoC8UMYotrrt+eyH8Eua3hDEgarNa4/ynPzMfMAchgrhl\n"\
"Fq4gT7F3yGFczTW5ezAKBggqhkjOPQQDAgNJADBGAiEA8gI9Ap5BTXsQSkkNJwkJ\n"\
"Oj91z70gjnF1sIxOBNKeSmYCIQD2Lv0/wne/t0Ome1U9hteDr+ClobGRr7UPFXx9\n"\
"6dI+wA==\n"\
"-----END CERTIFICATE-----\n"
7 changes: 7 additions & 0 deletions Projects/key_ch03b_ex01_client_secure/client_key.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
/* Private key of the TCP client generated by OpenSSL */
#define CLIENT_PRIVATE_KEY_PEM \
"-----BEGIN EC PRIVATE KEY-----\n"\
"MHcCAQEEIEBGIdEovAXfGF0NSXVk2edqcRByeF4KUJ8Pe/Qhxig9oAoGCCqGSM49\n"\
"AwEHoUQDQgAE3esUSnUXeJJEeMXkJnBAYOZeoC8UMYotrrt+eyH8Eua3hDEgarNa\n"\
"4/ynPzMfMAchgrhlFq4gT7F3yGFczTW5ew==\n"\
"-----END EC PRIVATE KEY-----\n"
14 changes: 14 additions & 0 deletions Projects/key_ch03b_ex01_client_secure/root_ca_crt.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
/* TCP server certificate generated by OpenSSL */
#define ROOTCA_PEM \
"-----BEGIN CERTIFICATE-----\n"\
"MIIB2DCCAX+gAwIBAgIUY/+5vDaHIb07T0rWQxL4uoZemJQwCgYIKoZIzj0EAwIw\n"\
"QjELMAkGA1UEBhMCWFgxFTATBgNVBAcMDERlZmF1bHQgQ2l0eTEcMBoGA1UECgwT\n"\
"RGVmYXVsdCBDb21wYW55IEx0ZDAeFw0yNDAzMDgxNzMyMTBaFw0zNDAzMDYxNzMy\n"\
"MTBaMEIxCzAJBgNVBAYTAlhYMRUwEwYDVQQHDAxEZWZhdWx0IENpdHkxHDAaBgNV\n"\
"BAoME0RlZmF1bHQgQ29tcGFueSBMdGQwWTATBgcqhkjOPQIBBggqhkjOPQMBBwNC\n"\
"AASMBNWVWPdwDhjNCE35vkjtX7/ZmK1RGUxLNbJwcWJZ7m7hxIKhkvmaBH5/SUG6\n"\
"t6KMgjVTIdPuE7HF+alB83w8o1MwUTAdBgNVHQ4EFgQUEWS7RXbR3ZVt5muYx6hg\n"\
"35yCNVMwHwYDVR0jBBgwFoAUEWS7RXbR3ZVt5muYx6hg35yCNVMwDwYDVR0TAQH/\n"\
"BAUwAwEB/zAKBggqhkjOPQQDAgNHADBEAiANaJ3WvcXDzkvulFF+x38CxiT+0LNZ\n"\
"em36ByPvoNGcIgIgFZY4NjvGIUi0itVoh7YnxyET6O4mVXAVt53AUAx7I3s=\n"\
"-----END CERTIFICATE-----\n"
14 changes: 14 additions & 0 deletions Projects/key_ch03b_ex02_server_secure/root_ca_crt.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
/* TCP server certificate generated by OpenSSL */
#define ROOTCA_PEM \
"-----BEGIN CERTIFICATE-----\n"\
"MIIB2DCCAX+gAwIBAgIUY/+5vDaHIb07T0rWQxL4uoZemJQwCgYIKoZIzj0EAwIw\n"\
"QjELMAkGA1UEBhMCWFgxFTATBgNVBAcMDERlZmF1bHQgQ2l0eTEcMBoGA1UECgwT\n"\
"RGVmYXVsdCBDb21wYW55IEx0ZDAeFw0yNDAzMDgxNzMyMTBaFw0zNDAzMDYxNzMy\n"\
"MTBaMEIxCzAJBgNVBAYTAlhYMRUwEwYDVQQHDAxEZWZhdWx0IENpdHkxHDAaBgNV\n"\
"BAoME0RlZmF1bHQgQ29tcGFueSBMdGQwWTATBgcqhkjOPQIBBggqhkjOPQMBBwNC\n"\
"AASMBNWVWPdwDhjNCE35vkjtX7/ZmK1RGUxLNbJwcWJZ7m7hxIKhkvmaBH5/SUG6\n"\
"t6KMgjVTIdPuE7HF+alB83w8o1MwUTAdBgNVHQ4EFgQUEWS7RXbR3ZVt5muYx6hg\n"\
"35yCNVMwHwYDVR0jBBgwFoAUEWS7RXbR3ZVt5muYx6hg35yCNVMwDwYDVR0TAQH/\n"\
"BAUwAwEB/zAKBggqhkjOPQQDAgNHADBEAiANaJ3WvcXDzkvulFF+x38CxiT+0LNZ\n"\
"em36ByPvoNGcIgIgFZY4NjvGIUi0itVoh7YnxyET6O4mVXAVt53AUAx7I3s=\n"\
"-----END CERTIFICATE-----\n"
13 changes: 13 additions & 0 deletions Projects/key_ch03b_ex02_server_secure/server_crt.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
/* TCP server certificate generated by OpenSSL */
#define SERVER_CERTIFICATE_PEM \
"-----BEGIN CERTIFICATE-----\n"\
"MIIBfzCCASUCFGOgkvBxqw/AHJeyoh9136VI4ySDMAoGCCqGSM49BAMCMEIxCzAJ\n"\
"BgNVBAYTAlhYMRUwEwYDVQQHDAxEZWZhdWx0IENpdHkxHDAaBgNVBAoME0RlZmF1\n"\
"bHQgQ29tcGFueSBMdGQwHhcNMjQwMzA4MjEwNzM3WhcNMzQwMzA2MjEwNzM3WjBC\n"\
"MQswCQYDVQQGEwJYWDEVMBMGA1UEBwwMRGVmYXVsdCBDaXR5MRwwGgYDVQQKDBNE\n"\
"ZWZhdWx0IENvbXBhbnkgTHRkMFkwEwYHKoZIzj0CAQYIKoZIzj0DAQcDQgAEcNIi\n"\
"KXt9FRegfYMHrQLYKhXNFJnDUP/94Ek/f0T0uC2a+isDfhWnYb6Waym4RF0/YzvC\n"\
"kwlbbTp7qNTvNTMCjTAKBggqhkjOPQQDAgNIADBFAiEAxLii8C6EtbR+Dr4zbkE5\n"\
"HIp/6qLhY/n+XqcI9yAWFn0CID0sW/O8jfMs9RhQdQ+lWPy35yc26KEIjMpd50R0\n"\
"vMFl\n"\
"-----END CERTIFICATE-----\n"
7 changes: 7 additions & 0 deletions Projects/key_ch03b_ex02_server_secure/server_key.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
/* Private key of the TCP Server generated by OpenSSL */
#define SERVER_PRIVATE_KEY_PEM \
"-----BEGIN EC PRIVATE KEY-----\n"\
"MHcCAQEEIMmEMlmaTHOF12k3/wzcalsX8ENSmdfJLXEP+8w6ljD2oAoGCCqGSM49\n"\
"AwEHoUQDQgAEcNIiKXt9FRegfYMHrQLYKhXNFJnDUP/94Ek/f0T0uC2a+isDfhWn\n"\
"Yb6Waym4RF0/YzvCkwlbbTp7qNTvNTMCjQ==\n"\
"-----END EC PRIVATE KEY-----\n"
13 changes: 13 additions & 0 deletions Projects/key_ch03b_ex03_dual_client/client_crt.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
/* TCP client certificate generated by OpenSSL */
#define CLIENT_CERTIFICATE_PEM \
"-----BEGIN CERTIFICATE-----\n"\
"MIIBgDCCASUCFGOgkvBxqw/AHJeyoh9136VI4ySCMAoGCCqGSM49BAMCMEIxCzAJ\n"\
"BgNVBAYTAlhYMRUwEwYDVQQHDAxEZWZhdWx0IENpdHkxHDAaBgNVBAoME0RlZmF1\n"\
"bHQgQ29tcGFueSBMdGQwHhcNMjQwMzA4MjAwMzA2WhcNMzQwMzA2MjAwMzA2WjBC\n"\
"MQswCQYDVQQGEwJYWDEVMBMGA1UEBwwMRGVmYXVsdCBDaXR5MRwwGgYDVQQKDBNE\n"\
"ZWZhdWx0IENvbXBhbnkgTHRkMFkwEwYHKoZIzj0CAQYIKoZIzj0DAQcDQgAE3esU\n"\
"SnUXeJJEeMXkJnBAYOZeoC8UMYotrrt+eyH8Eua3hDEgarNa4/ynPzMfMAchgrhl\n"\
"Fq4gT7F3yGFczTW5ezAKBggqhkjOPQQDAgNJADBGAiEA8gI9Ap5BTXsQSkkNJwkJ\n"\
"Oj91z70gjnF1sIxOBNKeSmYCIQD2Lv0/wne/t0Ome1U9hteDr+ClobGRr7UPFXx9\n"\
"6dI+wA==\n"\
"-----END CERTIFICATE-----\n"
7 changes: 7 additions & 0 deletions Projects/key_ch03b_ex03_dual_client/client_key.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
/* Private key of the TCP client generated by OpenSSL */
#define CLIENT_PRIVATE_KEY_PEM \
"-----BEGIN EC PRIVATE KEY-----\n"\
"MHcCAQEEIEBGIdEovAXfGF0NSXVk2edqcRByeF4KUJ8Pe/Qhxig9oAoGCCqGSM49\n"\
"AwEHoUQDQgAE3esUSnUXeJJEeMXkJnBAYOZeoC8UMYotrrt+eyH8Eua3hDEgarNa\n"\
"4/ynPzMfMAchgrhlFq4gT7F3yGFczTW5ew==\n"\
"-----END EC PRIVATE KEY-----\n"
14 changes: 14 additions & 0 deletions Projects/key_ch03b_ex03_dual_client/root_ca_crt.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
/* TCP server certificate generated by OpenSSL */
#define ROOTCA_PEM \
"-----BEGIN CERTIFICATE-----\n"\
"MIIB2DCCAX+gAwIBAgIUY/+5vDaHIb07T0rWQxL4uoZemJQwCgYIKoZIzj0EAwIw\n"\
"QjELMAkGA1UEBhMCWFgxFTATBgNVBAcMDERlZmF1bHQgQ2l0eTEcMBoGA1UECgwT\n"\
"RGVmYXVsdCBDb21wYW55IEx0ZDAeFw0yNDAzMDgxNzMyMTBaFw0zNDAzMDYxNzMy\n"\
"MTBaMEIxCzAJBgNVBAYTAlhYMRUwEwYDVQQHDAxEZWZhdWx0IENpdHkxHDAaBgNV\n"\
"BAoME0RlZmF1bHQgQ29tcGFueSBMdGQwWTATBgcqhkjOPQIBBggqhkjOPQMBBwNC\n"\
"AASMBNWVWPdwDhjNCE35vkjtX7/ZmK1RGUxLNbJwcWJZ7m7hxIKhkvmaBH5/SUG6\n"\
"t6KMgjVTIdPuE7HF+alB83w8o1MwUTAdBgNVHQ4EFgQUEWS7RXbR3ZVt5muYx6hg\n"\
"35yCNVMwHwYDVR0jBBgwFoAUEWS7RXbR3ZVt5muYx6hg35yCNVMwDwYDVR0TAQH/\n"\
"BAUwAwEB/zAKBggqhkjOPQQDAgNHADBEAiANaJ3WvcXDzkvulFF+x38CxiT+0LNZ\n"\
"em36ByPvoNGcIgIgFZY4NjvGIUi0itVoh7YnxyET6O4mVXAVt53AUAx7I3s=\n"\
"-----END CERTIFICATE-----\n"
14 changes: 14 additions & 0 deletions Projects/key_ch03b_ex04_dual_server/root_ca_crt.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
/* TCP server certificate generated by OpenSSL */
#define ROOTCA_PEM \
"-----BEGIN CERTIFICATE-----\n"\
"MIIB2DCCAX+gAwIBAgIUY/+5vDaHIb07T0rWQxL4uoZemJQwCgYIKoZIzj0EAwIw\n"\
"QjELMAkGA1UEBhMCWFgxFTATBgNVBAcMDERlZmF1bHQgQ2l0eTEcMBoGA1UECgwT\n"\
"RGVmYXVsdCBDb21wYW55IEx0ZDAeFw0yNDAzMDgxNzMyMTBaFw0zNDAzMDYxNzMy\n"\
"MTBaMEIxCzAJBgNVBAYTAlhYMRUwEwYDVQQHDAxEZWZhdWx0IENpdHkxHDAaBgNV\n"\
"BAoME0RlZmF1bHQgQ29tcGFueSBMdGQwWTATBgcqhkjOPQIBBggqhkjOPQMBBwNC\n"\
"AASMBNWVWPdwDhjNCE35vkjtX7/ZmK1RGUxLNbJwcWJZ7m7hxIKhkvmaBH5/SUG6\n"\
"t6KMgjVTIdPuE7HF+alB83w8o1MwUTAdBgNVHQ4EFgQUEWS7RXbR3ZVt5muYx6hg\n"\
"35yCNVMwHwYDVR0jBBgwFoAUEWS7RXbR3ZVt5muYx6hg35yCNVMwDwYDVR0TAQH/\n"\
"BAUwAwEB/zAKBggqhkjOPQQDAgNHADBEAiANaJ3WvcXDzkvulFF+x38CxiT+0LNZ\n"\
"em36ByPvoNGcIgIgFZY4NjvGIUi0itVoh7YnxyET6O4mVXAVt53AUAx7I3s=\n"\
"-----END CERTIFICATE-----\n"
13 changes: 13 additions & 0 deletions Projects/key_ch03b_ex04_dual_server/server_crt.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
/* TCP server certificate generated by OpenSSL */
#define SERVER_CERTIFICATE_PEM \
"-----BEGIN CERTIFICATE-----\n"\
"MIIBfzCCASUCFGOgkvBxqw/AHJeyoh9136VI4ySDMAoGCCqGSM49BAMCMEIxCzAJ\n"\
"BgNVBAYTAlhYMRUwEwYDVQQHDAxEZWZhdWx0IENpdHkxHDAaBgNVBAoME0RlZmF1\n"\
"bHQgQ29tcGFueSBMdGQwHhcNMjQwMzA4MjEwNzM3WhcNMzQwMzA2MjEwNzM3WjBC\n"\
"MQswCQYDVQQGEwJYWDEVMBMGA1UEBwwMRGVmYXVsdCBDaXR5MRwwGgYDVQQKDBNE\n"\
"ZWZhdWx0IENvbXBhbnkgTHRkMFkwEwYHKoZIzj0CAQYIKoZIzj0DAQcDQgAEcNIi\n"\
"KXt9FRegfYMHrQLYKhXNFJnDUP/94Ek/f0T0uC2a+isDfhWnYb6Waym4RF0/YzvC\n"\
"kwlbbTp7qNTvNTMCjTAKBggqhkjOPQQDAgNIADBFAiEAxLii8C6EtbR+Dr4zbkE5\n"\
"HIp/6qLhY/n+XqcI9yAWFn0CID0sW/O8jfMs9RhQdQ+lWPy35yc26KEIjMpd50R0\n"\
"vMFl\n"\
"-----END CERTIFICATE-----\n"
7 changes: 7 additions & 0 deletions Projects/key_ch03b_ex04_dual_server/server_key.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
/* Private key of the TCP Server generated by OpenSSL */
#define SERVER_PRIVATE_KEY_PEM \
"-----BEGIN EC PRIVATE KEY-----\n"\
"MHcCAQEEIMmEMlmaTHOF12k3/wzcalsX8ENSmdfJLXEP+8w6ljD2oAoGCCqGSM49\n"\
"AwEHoUQDQgAEcNIiKXt9FRegfYMHrQLYKhXNFJnDUP/94Ek/f0T0uC2a+isDfhWn\n"\
"Yb6Waym4RF0/YzvCkwlbbTp7qNTvNTMCjQ==\n"\
"-----END EC PRIVATE KEY-----\n"
51 changes: 51 additions & 0 deletions Scripts/format_aws_certificates.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
'''
Python Script to format certificates for aws_config.h file
for running AWS Publisher/Subscriber code example on Mbed OS
Developed on Python 3.7.4
Developed by Varun Kaushik
'''

import os

path = os.path.dirname(os.path.realpath(__file__))

#Function that adds a new line character and trailing backslash except on the final line
def add_newline(f):

with open(f, 'r') as fd:
lines = fd.read().splitlines()
if(f.endswith("private.pem.key")):
print("/* Thing Private Key */")
elif(f.endswith("certificate.pem.crt")):
print("/* Thing Certificate */")
elif(f.endswith("CA1.pem")):
print("/* Amazon Root Certificate */")
else:
return
line_num = 0
for i in lines:
i = "\""+i+"\\n\""
line_num = line_num + 1
if(len(lines) == line_num):
print(i)
else:
print(i+"\\")


#Main function. Execution starts here
if __name__ == '__main__':

files = os.listdir(path)
for f in files:
if (f.endswith(".crt") or f.endswith(".pem") or f.endswith(".pem.key")):
#print ("File: "+f)
add_newline(f)
print ("")

input()




37 changes: 37 additions & 0 deletions Scripts/format_certificate.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
'''
Python Script to format certificates
'''

import os
import sys

path = os.path.dirname(os.path.realpath(__file__))

#Function that adds a new line character and trailing backslash except on the final line
def add_newline(f):

with open(f, 'r') as fd:
lines = fd.read().splitlines()

line_num = 0
for i in lines:
i = "\""+i+"\\n\""
line_num = line_num + 1
if(len(lines) == line_num):
print(i)
else:
print(i+"\\")

#Main function. Execution starts here
if __name__ == '__main__':

if len(sys.argv) == 1:
filename = input("Enter Filename (you can also enter the filename on the command line): ")
else:
filename = sys.argv[1]

add_newline(filename)
print ("")

# [] END OF FILE

0 comments on commit af6cf4a

Please sign in to comment.