TLS: added command line to load certificate files

This commit is contained in:
SChernykh
2024-08-07 21:21:24 +02:00
parent c967c84e0e
commit 8960365f82
7 changed files with 99 additions and 0 deletions

View File

@@ -195,6 +195,18 @@ Params::Params(int argc, char* const argv[])
ok = true;
}
#ifdef WITH_TLS
if ((strcmp(argv[i], "--tls-cert") == 0) && (i + 1 < argc)) {
m_tlsCert = argv[++i];
ok = true;
}
if ((strcmp(argv[i], "--tls-cert-key") == 0) && (i + 1 < argc)) {
m_tlsCertKey = argv[++i];
ok = true;
}
#endif
if (!ok) {
fprintf(stderr, "Unknown command line parameter %s\n\n", argv[i]);
p2pool_usage();
@@ -240,6 +252,13 @@ bool Params::valid() const
return false;
}
#ifdef WITH_TLS
if (m_tlsCert.empty() != m_tlsCertKey.empty()) {
LOGERR(1, "Both --tls-cert and --tls-cert-key files must be specified");
return false;
}
#endif
return true;
}