tools: update arguments

Modify the tools to take the certificate and private key directly as arguments, rather than the path to the directory that contains them.

Change-Id: I18010c27379d8e985b596bed0159155343265112
diff --git a/tools/common.cpp b/tools/common.cpp
index 76597a8..aeb21ed 100644
--- a/tools/common.cpp
+++ b/tools/common.cpp
@@ -30,8 +30,7 @@
 namespace dhtnet {
 
 std::unique_ptr<ConnectionManager::Config>
-connectionManagerConfig(const std::filesystem::path& path,
-                        dht::crypto::Identity identity,
+connectionManagerConfig(dht::crypto::Identity identity,
                         const std::string& bootstrap,
                         std::shared_ptr<Logger> logger,
                         std::shared_ptr<tls::CertificateStore> certStore,
@@ -42,8 +41,7 @@
                         const std::string& turn_pass,
                         const std::string& turn_realm)
 {
-    std::filesystem::create_directories(path / "certstore");
-
+    std::filesystem::create_directories(PATH/"certstore");
     // DHT node creation: To make a connection manager at first a DHT node should be created
     dht::DhtRunner::Config dhtConfig;
     dhtConfig.dht_config.id = identity;
@@ -72,8 +70,8 @@
     config->id = identity;
     config->ioContext = ioContext;
     config->certStore = certStore;
+    config->cachePath = PATH;
     config->factory = iceFactory;
-    config->cachePath = path;
     config->logger = logger;
     if (!turn_host.empty()){
         config->turnEnabled = true;
diff --git a/tools/common.h b/tools/common.h
index 67672d0..d08512d 100644
--- a/tools/common.h
+++ b/tools/common.h
@@ -15,6 +15,7 @@
  *  along with this program. If not, see <https://www.gnu.org/licenses/>.
  */
 #include <opendht/crypto.h>
+#include <filesystem>
 #include "connectionmanager.h"
 #include "multiplexed_socket.h"
 #include "ice_transport_factory.h"
@@ -24,9 +25,9 @@
 
 using Buffer = std::shared_ptr<std::vector<uint8_t>>;
 constexpr size_t BUFFER_SIZE = 64 * 1024;
+const std::filesystem::path PATH = std::filesystem::path(getenv("HOME")) / ".dhtnet";
 
 std::unique_ptr<ConnectionManager::Config> connectionManagerConfig(
-    const std::filesystem::path& path,
     dht::crypto::Identity identity,
     const std::string& bootstrap,
     std::shared_ptr<Logger> logger,
diff --git a/tools/dnc/dnc.cpp b/tools/dnc/dnc.cpp
index 88bf61d..6bde30e 100644
--- a/tools/dnc/dnc.cpp
+++ b/tools/dnc/dnc.cpp
@@ -53,8 +53,7 @@
 }
 
 // Build a server
-Dnc::Dnc(const std::filesystem::path& path,
-         dht::crypto::Identity identity,
+Dnc::Dnc(dht::crypto::Identity identity,
          const std::string& bootstrap,
          const std::string& turn_host,
          const std::string& turn_user,
@@ -64,7 +63,7 @@
     : logger(dht::log::getStdLogger())
     , ioContext(std::make_shared<asio::io_context>()),
     iceFactory(std::make_shared<IceTransportFactory>(logger)),
-    certStore(std::make_shared<tls::CertificateStore>(path / "certstore", logger)),
+    certStore(std::make_shared<tls::CertificateStore>(PATH/"certstore", logger)),
     trustStore(std::make_shared<tls::TrustStore>(*certStore))
 {
     ioContextRunner = std::thread([context = ioContext, logger = logger] {
@@ -80,8 +79,7 @@
     auto ca = identity.second->issuer;
     trustStore->setCertificateStatus(ca->getId().toString(), tls::TrustStore::PermissionStatus::ALLOWED);
 
-    auto config = connectionManagerConfig(path,
-                                          identity,
+    auto config = connectionManagerConfig(identity,
                                           bootstrap,
                                           logger,
                                           certStore,
@@ -171,8 +169,7 @@
     });
 }
 // Build a client
-Dnc::Dnc(const std::filesystem::path& path,
-         dht::crypto::Identity identity,
+Dnc::Dnc(dht::crypto::Identity identity,
          const std::string& bootstrap,
          dht::InfoHash peer_id,
          const std::string& remote_host,
@@ -181,7 +178,7 @@
          const std::string& turn_user,
          const std::string& turn_pass,
          const std::string& turn_realm)
-    : Dnc(path, identity, bootstrap,turn_host,turn_user,turn_pass, turn_realm, true)
+    : Dnc(identity, bootstrap,turn_host,turn_user,turn_pass, turn_realm, true)
 {
     std::condition_variable cv;
     auto name = fmt::format("nc://{:s}:{:d}", remote_host, remote_port);
diff --git a/tools/dnc/dnc.h b/tools/dnc/dnc.h
index 77cfe9f..0f8e24e 100644
--- a/tools/dnc/dnc.h
+++ b/tools/dnc/dnc.h
@@ -32,7 +32,7 @@
 {
 public:
     // Build a server
-    Dnc(const std::filesystem::path& path,
+    Dnc(
         dht::crypto::Identity identity,
         const std::string& bootstrap,
         const std::string& turn_host,
@@ -41,7 +41,7 @@
         const std::string& turn_realm,
         const bool anonymous);
     // Build a client
-    Dnc(const std::filesystem::path& path,
+    Dnc(
         dht::crypto::Identity identity,
         const std::string& bootstrap,
         dht::InfoHash peer_id,
diff --git a/tools/dnc/dnc.yaml b/tools/dnc/dnc.yaml
index a107615..adf3be1 100644
--- a/tools/dnc/dnc.yaml
+++ b/tools/dnc/dnc.yaml
@@ -1,10 +1,10 @@
 bootstrap: "bootstrap.jami.net"
-id_path: HOME/.dhtnet # Change this to the path of the id directory
 turn_host: "turn.jami.net"
 turn_user: "ring"
 turn_pass: "ring"
 turn_realm: "ring"
 port: 22
 ip: "127.0.0.1"
-CA: HOME/.dhtnet # Change this to the path of the CA directory
-anonymous: false
\ No newline at end of file
+# certificate: "to/your/certificate.crt"
+# privateKey: "to/your/privatekey.pem"
+anonymous: true
\ No newline at end of file
diff --git a/tools/dnc/main.cpp b/tools/dnc/main.cpp
index 02debd5..239307d 100644
--- a/tools/dnc/main.cpp
+++ b/tools/dnc/main.cpp
@@ -37,7 +37,8 @@
     bool help {false};
     bool version {false};
     bool listen {false};
-    std::filesystem::path path {};
+    std::filesystem::path privateKey {};
+    std::filesystem::path cert {};
     std::string bootstrap {};
     std::string remote_host {};
     in_port_t remote_port {};
@@ -46,25 +47,24 @@
     std::string turn_user {};
     std::string turn_pass {};
     std::string turn_realm {};
-    std::string ca {};
-    std::string dnc_configuration {};
+    std::string configuration {};
     bool anonymous_cnx {false};
 };
 
 static const constexpr struct option long_options[]
     = {{"help", no_argument, nullptr, 'h'},
        {"version", no_argument, nullptr, 'v'},
-       {"port", required_argument, nullptr, 'p'},
+       {"port", required_argument, nullptr, 'P'},
        {"ip", required_argument, nullptr, 'i'},
        {"listen", no_argument, nullptr, 'l'},
        {"bootstrap", required_argument, nullptr, 'b'},
-       {"id_path", required_argument, nullptr, 'I'},
+       {"privateKey", required_argument, nullptr, 'p'},
        {"turn_host", required_argument, nullptr, 't'},
        {"turn_user", required_argument, nullptr, 'u'},
        {"turn_pass", required_argument, nullptr, 'w'},
        {"turn_realm", required_argument, nullptr, 'r'},
-       {"CA", required_argument, nullptr, 'C'},
-       {"dnc_configuration", required_argument, nullptr, 'd'},
+       {"cert", required_argument, nullptr, 'c'},
+       {"configuration", required_argument, nullptr, 'd'},
        {"anonymous_cnx", no_argument, nullptr, 'a'},
        {nullptr, 0, nullptr, 0}};
 
@@ -73,7 +73,7 @@
 {
     dhtnc_params params;
     int opt;
-    while ((opt = getopt_long(argc, argv, "ahvlw:r:u:t:I:b:p:i:C:d:", long_options, nullptr)) != -1) {
+    while ((opt = getopt_long(argc, argv, "ahvlw:r:u:t:P:b:p:i:c:d:", long_options, nullptr)) != -1) {
         switch (opt) {
         case 'h':
             params.help = true;
@@ -81,7 +81,7 @@
         case 'v':
             params.version = true;
             break;
-        case 'p':
+        case 'P':
             params.remote_port = std::stoi(optarg);
             break;
         case 'i':
@@ -93,8 +93,8 @@
         case 'b':
             params.bootstrap = optarg;
             break;
-        case 'I':
-            params.path = optarg;
+        case 'p':
+            params.privateKey = optarg;
             break;
         case 't':
             params.turn_host = optarg;
@@ -108,11 +108,11 @@
         case 'r':
             params.turn_realm = optarg;
             break;
-        case 'C':
-            params.ca = optarg;
+        case 'c':
+            params.cert = optarg;
             break;
         case 'd':
-            params.dnc_configuration = optarg;
+            params.configuration = optarg;
             break;
         case 'a':
             params.anonymous_cnx = true;
@@ -135,9 +135,9 @@
     }
 
     // extract values from dnc yaml file
-    if (!params.dnc_configuration.empty()) {
-        printf("read configuration file: %s\n", params.dnc_configuration.c_str());
-        std::ifstream config_file(params.dnc_configuration);
+    if (!params.configuration.empty()) {
+        printf("read configuration file: %s\n", params.configuration.c_str());
+        std::ifstream config_file(params.configuration);
         if (!config_file.is_open()) {
             std::cerr << "Error: Could not open configuration file.\n";
         } else {
@@ -145,8 +145,8 @@
             if (config["bootstrap"] && params.bootstrap.empty()) {
                 params.bootstrap = config["bootstrap"].as<std::string>();
             }
-            if (config["id_path"] && params.path.empty()) {
-                params.path = config["id_path"].as<std::string>();
+            if (config["privateKey"] && params.privateKey.empty()) {
+                params.privateKey = config["privateKey"].as<std::string>();
             }
             if (config["turn_host"] && params.turn_host.empty()) {
                 params.turn_host = config["turn_host"].as<std::string>();
@@ -160,11 +160,11 @@
             if (config["turn_realm"] && params.turn_realm.empty()) {
                 params.turn_realm = config["turn_realm"].as<std::string>();
             }
-            if (config["CA"] && params.ca.empty()) {
-                params.ca = config["CA"].as<std::string>();
+            if (config["certificate"] && params.cert.empty()) {
+                params.cert = config["certificate"].as<std::string>();
             }
             if (config["ip"] && params.remote_host.empty()) {
-                params.dnc_configuration = config["ip"].as<std::string>();
+                params.configuration = config["ip"].as<std::string>();
             }
             if (config["port"] && params.remote_port == 0) {
                 params.remote_port = config["port"].as<int>();
@@ -203,17 +203,17 @@
                    "\nOptions:\n"
                    "  -h, --help            Show this help message and exit.\n"
                    "  -v, --version         Display the program version.\n"
-                   "  -p, --port            Specify the port option with an argument.\n"
+                   "  -P, --port            Specify the port option with an argument.\n"
                    "  -i, --ip              Specify the ip option with an argument.\n"
                    "  -l, --listen          Start the program in listen mode.\n"
                    "  -b, --bootstrap       Specify the bootstrap option with an argument.\n"
-                   "  -I, --id_path         Specify the id_path option with an argument.\n"
                    "  -t, --turn_host       Specify the turn_host option with an argument.\n"
                    "  -u, --turn_user       Specify the turn_user option with an argument.\n"
                    "  -w, --turn_pass       Specify the turn_pass option with an argument.\n"
                    "  -r, --turn_realm      Specify the turn_realm option with an argument.\n"
-                   "  -C, --CA              Specify the CA option with an argument.\n"
-                   "  -d, --dnc_configuration Specify the dnc_configuration option with an argument.\n"
+                   "  -c, --certificate     Specify the certificate option with an argument.\n"
+                   "  -d, --configuration Specify the configuration option with an argument.\n"
+                   "  -p, --privateKey      Specify the privateKey option with an argument.\n"
                    "  -a, --anonymous_cnx   Enable the anonymous mode.\n");
         return EXIT_SUCCESS;
     }
@@ -222,17 +222,16 @@
         fmt::print("dnc v1.0\n");
         return EXIT_SUCCESS;
     }
-    auto identity = dhtnet::loadIdentity(params.path, params.ca);
 
+    auto identity = dhtnet::loadIdentity(params.privateKey, params.cert);
+    fmt::print("Loaded identity: {}\n", identity.second->getId());
 
     fmt::print("dnc 1.0\n");
-    fmt::print("Loaded identity: {} from {}\n", identity.second->getId(), params.path);
 
     std::unique_ptr<dhtnet::Dnc> dhtnc;
     if (params.listen) {
         // create dnc instance
-        dhtnc = std::make_unique<dhtnet::Dnc>(params.path,
-                                              identity,
+        dhtnc = std::make_unique<dhtnet::Dnc>(identity,
                                               params.bootstrap,
                                               params.turn_host,
                                               params.turn_user,
@@ -240,8 +239,7 @@
                                               params.turn_realm,
                                               params.anonymous_cnx);
     } else {
-        dhtnc = std::make_unique<dhtnet::Dnc>(params.path,
-                                              identity,
+        dhtnc = std::make_unique<dhtnet::Dnc>(identity,
                                               params.bootstrap,
                                               params.peer_id,
                                               params.remote_host,
diff --git a/tools/dsh/dsh.cpp b/tools/dsh/dsh.cpp
index 4e7507d..60637ff 100644
--- a/tools/dsh/dsh.cpp
+++ b/tools/dsh/dsh.cpp
@@ -85,8 +85,7 @@
     exit(EXIT_FAILURE);
 }
 
-dhtnet::Dsh::Dsh(const std::filesystem::path& path,
-                 dht::crypto::Identity identity,
+dhtnet::Dsh::Dsh(dht::crypto::Identity identity,
                  const std::string& bootstrap,
                  const std::string& turn_host,
                  const std::string& turn_user,
@@ -96,7 +95,7 @@
     :logger(dht::log::getStdLogger())
     , ioContext(std::make_shared<asio::io_context>()),
     iceFactory(std::make_shared<IceTransportFactory>(logger)),
-    certStore(std::make_shared<tls::CertificateStore>(path / "certstore", logger)),
+    certStore(std::make_shared<tls::CertificateStore>(PATH/"certstore", logger)),
     trustStore(std::make_shared<tls::TrustStore>(*certStore))
 {
     ioContext = std::make_shared<asio::io_context>();
@@ -112,8 +111,7 @@
     auto ca = identity.second->issuer;
     trustStore->setCertificateStatus(ca->getId().toString(), tls::TrustStore::PermissionStatus::ALLOWED);
     // Build a server
-    auto config = connectionManagerConfig(path,
-                                          identity,
+    auto config = connectionManagerConfig(identity,
                                           bootstrap,
                                           logger,
                                           certStore,
@@ -220,8 +218,7 @@
     });
 }
 
-dhtnet::Dsh::Dsh(const std::filesystem::path& path,
-                 dht::crypto::Identity identity,
+dhtnet::Dsh::Dsh(dht::crypto::Identity identity,
                  const std::string& bootstrap,
                  dht::InfoHash peer_id,
                  const std::string& binary,
@@ -229,7 +226,7 @@
                  const std::string& turn_user,
                  const std::string& turn_pass,
                  const std::string& turn_realm)
-    : Dsh(path, identity, bootstrap, turn_host, turn_user, turn_pass, turn_realm, false)
+    : Dsh(identity, bootstrap, turn_host, turn_user, turn_pass, turn_realm, false)
 {
     // Build a client
     std::condition_variable cv;
diff --git a/tools/dsh/dsh.h b/tools/dsh/dsh.h
index dd6a4ea..ec983a2 100644
--- a/tools/dsh/dsh.h
+++ b/tools/dsh/dsh.h
@@ -27,8 +27,7 @@
 {
 public:
     // Build a server
-    Dsh(const std::filesystem::path& path,
-        dht::crypto::Identity identity,
+    Dsh(dht::crypto::Identity identity,
         const std::string& bootstrap,
         const std::string& turn_host,
         const std::string& turn_user,
@@ -36,8 +35,7 @@
         const std::string& turn_realm,
         const bool anonymous);
     // Build a client
-    Dsh(const std::filesystem::path& path,
-        dht::crypto::Identity identity,
+    Dsh(dht::crypto::Identity identity,
         const std::string& bootstrap,
         dht::InfoHash peer_id,
         const std::string& binary,
diff --git a/tools/dsh/dsh.yaml b/tools/dsh/dsh.yaml
index a023aa3..1e23649 100644
--- a/tools/dsh/dsh.yaml
+++ b/tools/dsh/dsh.yaml
@@ -1,9 +1,9 @@
 bootstrap: "bootstrap.jami.net"
-id_path: HOME/.dhtnet # Change this to the path of the id directory
 turn_host: "turn.jami.net"
 turn_user: "ring"
 turn_pass: "ring"
 turn_realm: "ring"
 binary: "bash"
-CA: HOME/.dhtnet # Change this to the path of the CA directory
+# certificate: "/path/to/ca"
+# privateKey: "/path/to/privateKey"
 anonymous: false
diff --git a/tools/dsh/main.cpp b/tools/dsh/main.cpp
index 0e91e91..3b2592d 100644
--- a/tools/dsh/main.cpp
+++ b/tools/dsh/main.cpp
@@ -38,16 +38,16 @@
     bool help {false};
     bool version {false};
     bool listen {false};
-    std::filesystem::path path {};
+    std::filesystem::path privateKey {};
     std::string bootstrap {};
     dht::InfoHash peer_id {};
     std::string binary {};
-    std::string ca {};
+    std::filesystem::path cert {};
     std::string turn_host {};
     std::string turn_user {};
     std::string turn_pass {};
     std::string turn_realm {};
-    std::string dsh_configuration {};
+    std::string configuration {};
     bool anonymous_cnx {false};
 };
 
@@ -57,13 +57,13 @@
        {"listen", no_argument, nullptr, 'l'},
        {"bootstrap", required_argument, nullptr, 'b'},
        {"binary", required_argument, nullptr, 's'},
-       {"id_path", required_argument, nullptr, 'I'},
-       {"CA", required_argument, nullptr, 'C'},
+       {"privateKey", required_argument, nullptr, 'p'},
+       {"certificate", required_argument, nullptr, 'c'},
        {"turn_host", required_argument, nullptr, 't'},
        {"turn_user", required_argument, nullptr, 'u'},
        {"turn_pass", required_argument, nullptr, 'w'},
        {"turn_realm", required_argument, nullptr, 'r'},
-       {"dsh_configuration", required_argument, nullptr, 'd'},
+       {"configuration", required_argument, nullptr, 'd'},
        {"anonymous", no_argument, nullptr, 'a'},
        {nullptr, 0, nullptr, 0}};
 
@@ -72,7 +72,7 @@
 {
     dhtsh_params params;
     int opt;
-    while ((opt = getopt_long(argc, argv, "hvls:I:p:i:C:r:w:u:t:d:", long_options, nullptr)) != -1) {
+    while ((opt = getopt_long(argc, argv, "hvls:p:i:c:r:w:u:t:d:", long_options, nullptr)) != -1) {
         switch (opt) {
         case 'h':
             params.help = true;
@@ -89,8 +89,8 @@
         case 's':
             params.binary = optarg;
             break;
-        case 'I':
-            params.path = optarg;
+        case 'p':
+            params.privateKey = optarg;
             break;
         case 't':
             params.turn_host = optarg;
@@ -104,11 +104,11 @@
         case 'r':
             params.turn_realm = optarg;
             break;
-        case 'C':
-            params.ca = optarg;
+        case 'c':
+            params.cert = optarg;
             break;
         case 'd':
-            params.dsh_configuration = optarg;
+            params.configuration = optarg;
             break;
         case 'a':
             params.anonymous_cnx = true;
@@ -131,9 +131,9 @@
     }
 
     // extract values from dsh yaml file
-    if (!params.dsh_configuration.empty()) {
-        printf("read configuration file: %s\n", params.dsh_configuration.c_str());
-        std::ifstream config_file(params.dsh_configuration);
+    if (!params.configuration.empty()) {
+        printf("read configuration file: %s\n", params.configuration.c_str());
+        std::ifstream config_file(params.configuration);
         if (!config_file.is_open()) {
             std::cerr << "Error: Could not open configuration file.\n";
         } else {
@@ -141,8 +141,8 @@
             if (config["bootstrap"] && params.bootstrap.empty()) {
                 params.bootstrap = config["bootstrap"].as<std::string>();
             }
-            if (config["id_path"] && params.path.empty()) {
-                params.path = config["id_path"].as<std::string>();
+            if (config["privateKey"] && params.privateKey.empty()) {
+                params.privateKey = config["privateKey"].as<std::string>();
             }
             if (config["turn_host"] && params.turn_host.empty()) {
                 params.turn_host = config["turn_host"].as<std::string>();
@@ -156,8 +156,8 @@
             if (config["turn_realm"] && params.turn_realm.empty()) {
                 params.turn_realm = config["turn_realm"].as<std::string>();
             }
-            if (config["CA"] && params.ca.empty()) {
-                params.ca = config["CA"].as<std::string>();
+            if (config["certificate"] && params.cert.empty()) {
+                params.cert = config["certificate"].as<std::string>();
             }
             if (config["binary"] && params.binary.empty()) {
                 params.binary = config["binary"].as<std::string>();
@@ -203,8 +203,8 @@
                    "  -l, --listen          Start the program in listen mode.\n"
                    "  -b, --bootstrap       Specify the bootstrap option with an argument.\n"
                    "  -s, --binary          Specify the binary option with an argument.\n"
-                   "  -I, --id_path         Specify the id_path option with an argument.\n"
-                   "  -C, --CA              Specify the CA option with an argument.\n"
+                   "  -I, --privateKey      Specify the privateKey option with an argument.\n"
+                   "  -c, --c              Specify the certificate option with an argument.\n"
                    "  -t, --turn_host       Specify the turn_host option with an argument.\n"
                    "  -u, --turn_user       Specify the turn_user option with an argument.\n"
                    "  -w, --turn_pass       Specify the turn_pass option with an argument.\n"
@@ -218,14 +218,13 @@
 
     fmt::print("dsh 1.0\n");
 
-    auto identity = dhtnet::loadIdentity(params.path, params.ca);
-    fmt::print("Loaded identity: {} from {}\n", identity.second->getId(), params.path);
+    auto identity = dhtnet::loadIdentity(params.privateKey, params.cert);
+    fmt::print("Loaded identity: {} \n", identity.second->getId());
 
     std::unique_ptr<dhtnet::Dsh> dhtsh;
     if (params.listen) {
         // create dsh instance
-        dhtsh = std::make_unique<dhtnet::Dsh>(params.path,
-                                              identity,
+        dhtsh = std::make_unique<dhtnet::Dsh>(identity,
                                               params.bootstrap,
                                               params.turn_host,
                                               params.turn_user,
@@ -233,8 +232,7 @@
                                               params.turn_realm,
                                               params.anonymous_cnx);
     } else {
-        dhtsh = std::make_unique<dhtnet::Dsh>(params.path,
-                                              identity,
+        dhtsh = std::make_unique<dhtnet::Dsh>(identity,
                                               params.bootstrap,
                                               params.peer_id,
                                               params.binary,
diff --git a/tools/dvpn/dvpn.cpp b/tools/dvpn/dvpn.cpp
index b7a0d03..47cd95c 100644
--- a/tools/dvpn/dvpn.cpp
+++ b/tools/dvpn/dvpn.cpp
@@ -156,8 +156,7 @@
     return fd;
 }
 
-dhtnet::Dvpn::Dvpn(const std::filesystem::path& path,
-                   dht::crypto::Identity identity,
+dhtnet::Dvpn::Dvpn(dht::crypto::Identity identity,
                    const std::string& bootstrap,
                    const std::string& turn_host,
                    const std::string& turn_user,
@@ -167,7 +166,7 @@
     : logger(dht::log::getStdLogger())
     , ioContext(std::make_shared<asio::io_context>()),
     iceFactory(std::make_shared<IceTransportFactory>(logger)),
-    certStore(std::make_shared<tls::CertificateStore>(path / "certstore", logger)),
+    certStore(std::make_shared<tls::CertificateStore>(PATH/"certstore", logger)),
     trustStore(std::make_shared<tls::TrustStore>(*certStore))
 {
     ioContextRunner = std::thread([context = ioContext, logger = logger] {
@@ -182,8 +181,7 @@
     auto ca = identity.second->issuer;
     trustStore->setCertificateStatus(ca->getId().toString(), tls::TrustStore::PermissionStatus::ALLOWED);
 
-    auto config = connectionManagerConfig(path,
-                                          identity,
+    auto config = connectionManagerConfig(identity,
                                           bootstrap,
                                           logger,
                                           certStore,
@@ -200,8 +198,7 @@
 
 }
 
-dhtnet::DvpnServer::DvpnServer(const std::filesystem::path& path,
-                               dht::crypto::Identity identity,
+dhtnet::DvpnServer::DvpnServer(dht::crypto::Identity identity,
                                const std::string& bootstrap,
                                const std::string& turn_host,
                                const std::string& turn_user,
@@ -209,7 +206,7 @@
                                const std::string& turn_realm,
                                const std::string& configuration_file,
                                bool anonymous)
-    : Dvpn(path, identity, bootstrap, turn_host, turn_user, turn_pass, turn_realm, configuration_file)
+    : Dvpn(identity, bootstrap, turn_host, turn_user, turn_pass, turn_realm, configuration_file)
 {
     std::mutex mtx;
     std::unique_lock<std::mutex> lk {mtx};
@@ -294,16 +291,14 @@
 
 // Build a client
 dhtnet::DvpnClient::DvpnClient(dht::InfoHash peer_id,
-                               const std::filesystem::path& path,
                                dht::crypto::Identity identity,
                                const std::string& bootstrap,
-
                                const std::string& turn_host,
                                const std::string& turn_user,
                                const std::string& turn_pass,
                                const std::string& turn_realm,
                                const std::string& configuration_file)
-    : Dvpn(path, identity, bootstrap, turn_host, turn_user, turn_pass, turn_realm, configuration_file)
+    : Dvpn(identity, bootstrap, turn_host, turn_user, turn_pass, turn_realm, configuration_file)
 {
     // connect to a peer
     connectionManager->connectDevice(
diff --git a/tools/dvpn/dvpn.h b/tools/dvpn/dvpn.h
index 6331907..e17775a 100644
--- a/tools/dvpn/dvpn.h
+++ b/tools/dvpn/dvpn.h
@@ -48,8 +48,7 @@
 class Dvpn
 {
 public:
-    Dvpn(const std::filesystem::path& path,
-         dht::crypto::Identity identity,
+    Dvpn(dht::crypto::Identity identity,
          const std::string& bootstrap,
          const std::string& turn_host,
          const std::string& turn_user,
@@ -73,8 +72,7 @@
 {
 public:
     // Build a server
-    DvpnServer(const std::filesystem::path& path,
-               dht::crypto::Identity identity,
+    DvpnServer(dht::crypto::Identity identity,
                const std::string& bootstrap,
                const std::string& turn_host,
                const std::string& turn_user,
@@ -89,7 +87,6 @@
 public:
     // Build a client
     DvpnClient(dht::InfoHash peer_id,
-               const std::filesystem::path& path,
                dht::crypto::Identity identity,
                const std::string& bootstrap,
                const std::string& turn_host,
diff --git a/tools/dvpn/dvpn.yaml b/tools/dvpn/dvpn.yaml
index 7e14842..5a3b155 100644
--- a/tools/dvpn/dvpn.yaml
+++ b/tools/dvpn/dvpn.yaml
@@ -1,9 +1,9 @@
 bootstrap: "bootstrap.jami.net"
-id_path: HOME/.dhtnet # Change this to the path of the id directory
 turn_host: "turn.jami.net"
 turn_user: "ring"
 turn_pass: "ring"
 turn_realm: "ring"
-configuration_file: "HOME/dhtnet/tools/dvpn/dvpn.yaml" # Change this to the path of the dvpn.yaml file
-CA: HOME/.dhtnet # Change this to the path of the CA directory
+# configuration_file: "HOME/dhtnet/tools/dvpn/dvpn.yaml" # Change this to the path of the dvpn.yaml file
+# certificate: /path/to/certificate
+# privateKey: /path/to/privateKey
 anonymous: false
\ No newline at end of file
diff --git a/tools/dvpn/main.cpp b/tools/dvpn/main.cpp
index 8cbeebc..153a607 100644
--- a/tools/dvpn/main.cpp
+++ b/tools/dvpn/main.cpp
@@ -37,7 +37,7 @@
     bool help {false};
     bool version {false};
     bool listen {false};
-    std::filesystem::path path {};
+    std::filesystem::path privateKey {};
     std::string bootstrap {};
     dht::InfoHash peer_id {};
     std::string turn_host {};
@@ -45,8 +45,8 @@
     std::string turn_pass {};
     std::string turn_realm {};
     std::string configuration_file {};
-    std::string ca {};
-    std::string dvpn_configuration_file {};
+    std::filesystem::path cert {};
+    std::string configuration {};
     bool anonymous_cnx {false};
 };
 
@@ -55,14 +55,14 @@
        {"version", no_argument, nullptr, 'v'},
        {"listen", no_argument, nullptr, 'l'},
        {"bootstrap", required_argument, nullptr, 'b'},
-       {"id_path", required_argument, nullptr, 'I'},
+       {"privateKey", required_argument, nullptr, 'p'},
        {"turn_host", required_argument, nullptr, 't'},
        {"turn_user", required_argument, nullptr, 'u'},
        {"turn_pass", required_argument, nullptr, 'w'},
        {"turn_realm", required_argument, nullptr, 'r'},
-       {"vpn_configuration_file", required_argument, nullptr, 'c'},
-       {"CA", required_argument, nullptr, 'C'},
-       {"dvpn_configuration_file", required_argument, nullptr, 'd'},
+       {"vpn_configuration_file", required_argument, nullptr, 'C'},
+       {"certificate", required_argument, nullptr, 'c'},
+       {"configuration", required_argument, nullptr, 'd'},
        {"anonymous", no_argument, nullptr, 'a'},
        {nullptr, 0, nullptr, 0}};
 
@@ -71,7 +71,7 @@
 {
     dhtvpn_params params;
     int opt;
-    while ((opt = getopt_long(argc, argv, "hvlw:r:u:t:I:b:c:C:d:", long_options, nullptr)) != -1) {
+    while ((opt = getopt_long(argc, argv, "hvlw:r:u:t:p:b:c:C:d:", long_options, nullptr)) != -1) {
         switch (opt) {
         case 'h':
             params.help = true;
@@ -85,8 +85,8 @@
         case 'b':
             params.bootstrap = optarg;
             break;
-        case 'I':
-            params.path = optarg;
+        case 'p':
+            params.privateKey = optarg;
             break;
         case 't':
             params.turn_host = optarg;
@@ -100,14 +100,14 @@
         case 'r':
             params.turn_realm = optarg;
             break;
-        case 'c':
+        case 'C':
             params.configuration_file = optarg;
             break;
-        case 'C':
-            params.ca = optarg;
+        case 'c':
+            params.cert = optarg;
             break;
         case 'd':
-            params.dvpn_configuration_file = optarg;
+            params.configuration = optarg;
             break;
         case 'a':
             params.anonymous_cnx = true;
@@ -118,9 +118,9 @@
         }
     }
     // extract values from dvpn yaml file
-    if (!params.dvpn_configuration_file.empty()) {
-        printf("read configuration file: %s\n", params.dvpn_configuration_file.c_str());
-        std::ifstream config_file(params.dvpn_configuration_file);
+    if (!params.configuration.empty()) {
+        printf("read configuration file: %s\n", params.configuration.c_str());
+        std::ifstream config_file(params.configuration);
         if (!config_file.is_open()) {
             std::cerr << "Error: Could not open configuration file.\n";
         } else {
@@ -128,8 +128,8 @@
             if (config["bootstrap"] && params.bootstrap.empty()) {
                 params.bootstrap = config["bootstrap"].as<std::string>();
             }
-            if (config["id_path"] && params.path.empty()) {
-                params.path = config["id_path"].as<std::string>();
+            if (config["privateKey"] && params.privateKey.empty()) {
+                params.privateKey = config["privateKey"].as<std::string>();
             }
             if (config["turn_host"] && params.turn_host.empty()) {
                 params.turn_host = config["turn_host"].as<std::string>();
@@ -143,8 +143,8 @@
             if (config["turn_realm"] && params.turn_realm.empty()) {
                 params.turn_realm = config["turn_realm"].as<std::string>();
             }
-            if (config["CA"] && params.ca.empty()) {
-                params.ca = config["CA"].as<std::string>();
+            if (config["certificate"] && params.cert.empty()) {
+                params.cert = config["certificate"].as<std::string>();
             }
             if (config["configuration_file"] && params.configuration_file.empty()) {
                 params.configuration_file = config["configuration_file"].as<std::string>();
@@ -197,14 +197,14 @@
             "  -v, --version         Display the program version.\n"
             "  -l, --listen          Start the program in listen mode.\n"
             "  -b, --bootstrap       Specify the bootstrap option with an argument.\n"
-            "  -I, --id_path         Specify the id_path option with an argument.\n"
+            "  -p, --privateKey      Specify the privateKey option with an argument.\n"
             "  -t, --turn_host       Specify the turn_host option with an argument.\n"
             "  -u, --turn_user       Specify the turn_user option with an argument.\n"
             "  -w, --turn_pass       Specify the turn_pass option with an argument.\n"
             "  -r, --turn_realm      Specify the turn_realm option with an argument.\n"
-            "  -c, --vpn_configuration_file Specify the vpn_configuration_file path option with an argument.\n"
-            "  -C, --CA              Specify the CA path option with an argument.\n"
-            "  -d, --dvpn_configuration_file Specify the dvpn_configuration_file path option with an argument.\n"
+            "  -C, --vpn_configuration Specify the vpn_configuration path option with an argument.\n"
+            "  -c, --certificate              Specify the certificate path option with an argument.\n"
+            "  -d, --configuration Specify the configuration path option with an argument.\n"
             "  -a, --anonymous       Specify the anonymous option with an argument.\n"
             "\n");
         return EXIT_SUCCESS;
@@ -216,14 +216,13 @@
 
     fmt::print("dvpn 1.0\n");
 
-    auto identity = dhtnet::loadIdentity(params.path, params.ca);
-    fmt::print("Loaded identity: {} from {}\n", identity.second->getId(), params.path);
+    auto identity = dhtnet::loadIdentity(params.privateKey, params.cert);
+    fmt::print("Loaded identity: {}\n", identity.second->getId());
 
     std::unique_ptr<dhtnet::Dvpn> dvpn;
     if (params.listen) {
         // create dvpn instance
-        dvpn = std::make_unique<dhtnet::DvpnServer>(params.path,
-                                                    identity,
+        dvpn = std::make_unique<dhtnet::DvpnServer>(identity,
                                                     params.bootstrap,
                                                     params.turn_host,
                                                     params.turn_user,
@@ -233,7 +232,6 @@
                                                     params.anonymous_cnx);
     } else {
         dvpn = std::make_unique<dhtnet::DvpnClient>(params.peer_id,
-                                                    params.path,
                                                     identity,
                                                     params.bootstrap,
                                                     params.turn_host,