mirror of
https://github.com/RetroShare/RetroShare.git
synced 2025-07-31 02:09:15 -04:00
updated tor manager/control to save/parse keys in new format
This commit is contained in:
parent
788bd81b41
commit
210518db80
7 changed files with 144 additions and 57 deletions
|
@ -90,6 +90,13 @@ void HiddenService::addTarget(quint16 servicePort, QHostAddress targetAddress, q
|
|||
m_targets.append(t);
|
||||
}
|
||||
|
||||
void HiddenService::setServiceId(const QByteArray& sid)
|
||||
{
|
||||
m_service_id = sid;
|
||||
m_hostname = sid + ".onion";
|
||||
|
||||
emit hostnameChanged();
|
||||
}
|
||||
void HiddenService::setPrivateKey(const CryptoKey &key)
|
||||
{
|
||||
if (m_privateKey.isLoaded()) {
|
||||
|
@ -97,13 +104,15 @@ void HiddenService::setPrivateKey(const CryptoKey &key)
|
|||
return;
|
||||
}
|
||||
|
||||
#ifdef TO_REMOVE
|
||||
if (!key.isPrivate()) {
|
||||
BUG() << "Cannot create a hidden service with a public key";
|
||||
return;
|
||||
}
|
||||
#endif
|
||||
|
||||
m_privateKey = key;
|
||||
m_hostname = m_privateKey.torServiceID() + QStringLiteral(".onion");
|
||||
|
||||
emit privateKeyChanged();
|
||||
}
|
||||
|
||||
|
@ -112,13 +121,13 @@ void HiddenService::loadPrivateKey()
|
|||
if (m_privateKey.isLoaded() || m_dataPath.isEmpty())
|
||||
return;
|
||||
|
||||
bool ok = m_privateKey.loadFromFile(m_dataPath + QLatin1String("/private_key"), CryptoKey::PrivateKey);
|
||||
bool ok = m_privateKey.loadFromFile(m_dataPath + QLatin1String("/private_key"));
|
||||
|
||||
if (!ok) {
|
||||
qWarning() << "Failed to load hidden service key";
|
||||
return;
|
||||
}
|
||||
|
||||
m_hostname = m_privateKey.torServiceID();
|
||||
emit privateKeyChanged();
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue