Skip to content
Snippets Groups Projects
Commit e66ba708 authored by Edric Milaret's avatar Edric Milaret Committed by gerrit2
Browse files

ios: fix dht certificate path

We can't save and use the fullpath of the certificate as it change
at each start on Simulator and at update on real device

Change-Id: I82e6e3c500cd6396edeca6c72785d82aee311979
Tuleap: #313
parent 4b4dcdfc
No related branches found
No related tags found
No related merge requests found
......@@ -459,8 +459,14 @@ RingAccount::loadIdentity()
dht::crypto::PrivateKey dht_key;
try {
#if TARGET_OS_IPHONE
const auto path = fileutils::get_data_dir() + DIR_SEPARATOR_STR + getAccountID() + DIR_SEPARATOR_STR;
dht_cert = dht::crypto::Certificate(fileutils::loadFile(path + tlsCertificateFile_));
dht_key = dht::crypto::PrivateKey(fileutils::loadFile(path + tlsPrivateKeyFile_), tlsPassword_);
#else
dht_cert = dht::crypto::Certificate(fileutils::loadFile(tlsCertificateFile_));
dht_key = dht::crypto::PrivateKey(fileutils::loadFile(tlsPrivateKeyFile_), tlsPassword_);
#endif
}
catch (const std::exception& e) {
RING_ERR("Error loading identity: %s", e.what());
......@@ -479,8 +485,13 @@ RingAccount::loadIdentity()
// save the chain including CA
saveIdentity(id, idPath_ + DIR_SEPARATOR_STR "dht");
#if TARGET_OS_IPHONE
tlsCertificateFile_ = "dht.crt";
tlsPrivateKeyFile_ = "dht.key";
#else
tlsCertificateFile_ = idPath_ + DIR_SEPARATOR_STR "dht.crt";
tlsPrivateKeyFile_ = idPath_ + DIR_SEPARATOR_STR "dht.key";
#endif
tlsPassword_ = {};
username_ = RING_URI_PREFIX+id.second->getId().toString();
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment