NetBurner 3.5.7
PDF Version
ssl_config.h
1/*NB_REVISION*/
2
3/*NB_COPYRIGHT*/
4
5#ifndef _SSL_CONFIG_H_
6#define _SSL_CONFIG_H_
7
19/*
20 * SSL Certificate Source Options
21 * These define where the SSL certificate/key pair comes from
22 */
23#define SSL_CERT_SOURCE_LIBRARY_DEFAULT ((uint8_t)0x00) // Use auto-generated certificate
24#define SSL_CERT_SOURCE_USER_INSTALLED ((uint8_t)0x01) // User-installed via web upload
25
26/*
27 * Certificate and Key Size Limits
28 * Based on typical certificate sizes:
29 * - RSA 2048-bit certificates are typically 1-2KB
30 * - RSA 4096-bit certificates can be up to 4KB
31 * - ECDSA certificates are typically smaller
32 */
33#define SSL_CERTIFICATE_SIZE_MAX ((2 * 1024) - 1) // Max DER/binary size
34#define SSL_CERTIFICATE_SIZE_MAX_PEM ((3 * 1024) - 1) // Max PEM-encoded size
35#define SSL_KEY_SIZE_MAX_PEM ((4 * 1024) - 1) // Max PEM-encoded key size
36
37/*
38 * File names for stored certificates on flash
39 */
40#define SSL_FILE_NAME_CERT "cert.crt"
41#define SSL_FILE_NAME_KEY "cert.key"
42
43/*
44 * SSL Status codes for certificate operations
45 */
46#define SSL_STATUS_VALID (0)
47#define SSL_STATUS_NOT_FOUND (1)
48#define SSL_STATUS_INVALID (2)
49#define SSL_STATUS_CERT_INVALID (3)
50#define SSL_STATUS_KEY_INVALID (4)
51#define SSL_STATUS_CERT_KEY_MISMATCH (5)
52
53/*
54 * HTTPS Service Status
55 * Tracks the state of HTTPS certificate generation and availability
56 */
57enum HttpsServiceStatus : uint8_t
58{
59 HTTPS_STATUS_DISABLED = 0, // HTTPS disabled in config
60 HTTPS_STATUS_WAITING_FOR_GPS = 1, // Waiting for GPS time to generate cert
61 HTTPS_STATUS_GENERATING_CERT = 2, // Currently generating certificate
62 HTTPS_STATUS_CERT_FAILED = 3, // Certificate generation failed
63 HTTPS_STATUS_ACTIVE = 4, // HTTPS is active with valid cert
64 HTTPS_STATUS_USER_CERT = 5, // HTTPS active with user-installed cert
65};
66
67// Global status variable (defined in main.cpp)
68extern volatile HttpsServiceStatus gHttpsStatus;
69
70#endif /* _SSL_CONFIG_H_ */