Merge pull request #2073 from csoler/v0.6-TorV3

Compatibility with Tor v3, with retrocompatibility for existing nodes
This commit is contained in:
csoler 2020-10-11 12:04:11 +02:00 committed by GitHub
commit 2d17874d2d
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
11 changed files with 230 additions and 107 deletions

View file

@ -1392,7 +1392,7 @@ bool p3Peers::parseShortInvite(const std::string& inviteStrUrl, RsPeerDetails& d
case RsShortInviteFieldType::HIDDEN_LOCATOR: case RsShortInviteFieldType::HIDDEN_LOCATOR:
details.hiddenType = (((uint32_t)buf[0]) << 24)+(((uint32_t)buf[1])<<16)+(((uint32_t)buf[2])<<8) + (uint32_t)buf[3]; details.hiddenType = (((uint32_t)buf[0]) << 24)+(((uint32_t)buf[1])<<16)+(((uint32_t)buf[2])<<8) + (uint32_t)buf[3];
details.hiddenNodePort = (((uint32_t)buf[4]) << 8)+ (uint32_t)buf[5]; details.hiddenNodePort = (((uint32_t)buf[4]) << 8)+ (uint32_t)buf[5];
details.isHiddenNode = true;
details.hiddenNodeAddress = std::string((char*)&buf[6],s-6); details.hiddenNodeAddress = std::string((char*)&buf[6],s-6);
break; break;
@ -1538,7 +1538,7 @@ std::string p3Peers::GetRetroshareInvite(
if (getPeerDetails(ssl_id, detail)) if (getPeerDetails(ssl_id, detail))
{ {
if(!includeExtraLocators) detail.ipAddressList.clear(); if(!includeExtraLocators && !detail.isHiddenNode) detail.ipAddressList.clear();
unsigned char *mem_block = nullptr; unsigned char *mem_block = nullptr;
size_t mem_block_size = 0; size_t mem_block_size = 0;

View file

@ -53,10 +53,12 @@ QByteArray AddOnionCommand::build()
QByteArray out("ADD_ONION"); QByteArray out("ADD_ONION");
if (m_service->privateKey().isLoaded()) { if (m_service->privateKey().isLoaded()) {
out += " RSA1024:"; out += " ";
out += m_service->privateKey().encodedPrivateKey(CryptoKey::DER).toBase64(); out += m_service->privateKey().bytes();
} else { } else {
out += " NEW:RSA1024"; //out += " NEW:RSA1024"; // this is v2. For v3, use NEW:BEST, or NEW:ED25519-V3
//out += " NEW:ED25519-V3"; // this is v3.
out += " NEW:BEST"; // this is v3, but without control of key type. Generates a RSA1024 key on older Tor versions.
} }
foreach (const HiddenService::Target &target, m_service->targets()) { foreach (const HiddenService::Target &target, m_service->targets()) {
@ -80,12 +82,21 @@ void AddOnionCommand::onReply(int statusCode, const QByteArray &data)
return; return;
} }
const QByteArray keyPrefix("PrivateKey=RSA1024:"); const QByteArray keyPrefix("PrivateKey=");
const QByteArray sidPrefix("ServiceID=");
if(data.startsWith("ServiceID=")){
QByteArray service_id = data.mid(sidPrefix.size());
m_service->setServiceId(service_id);
}
if (data.startsWith(keyPrefix)) { if (data.startsWith(keyPrefix)) {
QByteArray keyData(QByteArray::fromBase64(data.mid(keyPrefix.size())));
QByteArray keyData(data.mid(keyPrefix.size()));
CryptoKey key; CryptoKey key;
if (!key.loadFromData(keyData, CryptoKey::PrivateKey, CryptoKey::DER)) {
m_errorMessage = QStringLiteral("Key decoding failed"); if (!key.loadFromTorMessage(keyData)) {
m_errorMessage = QStringLiteral("Key structure check failed");
return; return;
} }

View file

@ -30,11 +30,14 @@
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/ */
#include <iostream>
#include "CryptoKey.h" #include "CryptoKey.h"
#include "SecureRNG.h" #include "SecureRNG.h"
#include "Useful.h" #include "Useful.h"
#include <QtDebug> #include <QtDebug>
#include <QFile> #include <QFile>
#include <QByteArray>
#include <openssl/bn.h> #include <openssl/bn.h>
#include <openssl/bio.h> #include <openssl/bio.h>
#include <openssl/pem.h> #include <openssl/pem.h>
@ -48,8 +51,10 @@ void RSA_get0_factors(const RSA *r, const BIGNUM **p, const BIGNUM **q)
#define RSA_bits(o) (BN_num_bits((o)->n)) #define RSA_bits(o) (BN_num_bits((o)->n))
#endif #endif
#ifdef TO_REMOVE
void base32_encode(char *dest, unsigned destlen, const char *src, unsigned srclen); void base32_encode(char *dest, unsigned destlen, const char *src, unsigned srclen);
bool base32_decode(char *dest, unsigned destlen, const char *src, unsigned srclen); bool base32_decode(char *dest, unsigned destlen, const char *src, unsigned srclen);
#endif
CryptoKey::CryptoKey() CryptoKey::CryptoKey()
{ {
@ -60,6 +65,7 @@ CryptoKey::~CryptoKey()
clear(); clear();
} }
#ifdef TO_REMOVE
CryptoKey::Data::~Data() CryptoKey::Data::~Data()
{ {
if (key) if (key)
@ -68,12 +74,14 @@ CryptoKey::Data::~Data()
key = 0; key = 0;
} }
} }
#endif
void CryptoKey::clear() void CryptoKey::clear()
{ {
d = 0; key_data.clear();
} }
#ifdef TO_REMOVE
bool CryptoKey::loadFromData(const QByteArray &data, KeyType type, KeyFormat format) bool CryptoKey::loadFromData(const QByteArray &data, KeyType type, KeyFormat format)
{ {
RSA *key = NULL; RSA *key = NULL;
@ -110,23 +118,91 @@ bool CryptoKey::loadFromData(const QByteArray &data, KeyType type, KeyFormat for
d = new Data(key); d = new Data(key);
return true; return true;
} }
#endif
bool CryptoKey::loadFromFile(const QString &path, KeyType type, KeyFormat format) bool CryptoKey::loadFromFile(const QString& path)
{ {
QFile file(path); QFile file(path);
if (!file.open(QIODevice::ReadOnly)) if (!file.open(QIODevice::ReadOnly))
{ {
qWarning() << "Failed to open" << (type == PrivateKey ? "private" : "public") << "key from" qWarning() << "Failed to open Tor key file " << path << ": " << file.errorString();
<< path << "-" << file.errorString();
return false; return false;
} }
QByteArray data = file.readAll(); QByteArray data = file.readAll();
file.close(); file.close();
return loadFromData(data, type, format); if(data.contains("-----BEGIN RSA PRIVATE KEY-----"))
{
std::cerr << "Note: Reading/converting Tor v2 key format." << std::endl;
// This to be compliant with old format. New format is oblivious to the type of key so we dont need a header
data = data.replace("-----BEGIN RSA PRIVATE KEY-----",nullptr);
data = data.replace("-----END RSA PRIVATE KEY-----",nullptr);
data = data.replace("\n",nullptr);
data = data.replace("\t",nullptr);
data = "RSA1024:"+data;
}
std::cerr << "Have read the following key: " << std::endl;
std::cerr << QString(data).toStdString() << std::endl;
key_data = data;
return true;
} }
bool CryptoKey::loadFromTorMessage(const QByteArray& b)
{
// note: We should probably check the structure a bit more, for security.
std::cerr << "Loading new key:" << std::endl;
if(b.startsWith("RSA1024"))
std::cerr << " type: RSA-1024 (Tor v2)" << std::endl;
else if(b.startsWith("ED25519-V3"))
std::cerr << " type: ED25519-V3 (Tor v3)" << std::endl;
else if(b.indexOf(':'))
{
std::cerr << " unknown type, or bad syntax in key: \"" << b.left(b.indexOf(':')).toStdString() << "\". Not accepted." << std::endl;
return false;
}
key_data = b;
return true;
}
/* Cryptographic hash of a password as expected by Tor's HashedControlPassword */
QByteArray torControlHashedPassword(const QByteArray &password)
{
QByteArray salt = SecureRNG::random(8);
if (salt.isNull())
return QByteArray();
int count = ((quint32)16 + (96 & 15)) << ((96 >> 4) + 6);
SHA_CTX hash;
SHA1_Init(&hash);
QByteArray tmp = salt + password;
while (count)
{
int c = qMin(count, tmp.size());
SHA1_Update(&hash, reinterpret_cast<const void*>(tmp.constData()), c);
count -= c;
}
unsigned char md[20];
SHA1_Final(md, &hash);
/* 60 is the hex-encoded value of 96, which is a constant used by Tor's algorithm. */
return QByteArray("16:") + salt.toHex().toUpper() + QByteArray("60") +
QByteArray::fromRawData(reinterpret_cast<const char*>(md), 20).toHex().toUpper();
}
#ifdef TO_REMOVE
bool CryptoKey::isPrivate() const bool CryptoKey::isPrivate() const
{ {
if (!isLoaded()) { if (!isLoaded()) {
@ -326,34 +402,6 @@ bool CryptoKey::verifySHA256(const QByteArray &digest, QByteArray signature) con
return true; return true;
} }
/* Cryptographic hash of a password as expected by Tor's HashedControlPassword */
QByteArray torControlHashedPassword(const QByteArray &password)
{
QByteArray salt = SecureRNG::random(8);
if (salt.isNull())
return QByteArray();
int count = ((quint32)16 + (96 & 15)) << ((96 >> 4) + 6);
SHA_CTX hash;
SHA1_Init(&hash);
QByteArray tmp = salt + password;
while (count)
{
int c = qMin(count, tmp.size());
SHA1_Update(&hash, reinterpret_cast<const void*>(tmp.constData()), c);
count -= c;
}
unsigned char md[20];
SHA1_Final(md, &hash);
/* 60 is the hex-encoded value of 96, which is a constant used by Tor's algorithm. */
return QByteArray("16:") + salt.toHex().toUpper() + QByteArray("60") +
QByteArray::fromRawData(reinterpret_cast<const char*>(md), 20).toHex().toUpper();
}
/* Copyright (c) 2001-2004, Roger Dingledine /* Copyright (c) 2001-2004, Roger Dingledine
* Copyright (c) 2004-2006, Roger Dingledine, Nick Mathewson * Copyright (c) 2004-2006, Roger Dingledine, Nick Mathewson
* Copyright (c) 2007-2010, The Tor Project, Inc. * Copyright (c) 2007-2010, The Tor Project, Inc.
@ -475,3 +523,5 @@ bool base32_decode(char *dest, unsigned destlen, const char *src, unsigned srcle
delete[] tmp; delete[] tmp;
return true; return true;
} }
#endif

View file

@ -51,14 +51,19 @@ public:
}; };
CryptoKey(); CryptoKey();
CryptoKey(const CryptoKey &other) : d(other.d) { }
~CryptoKey(); ~CryptoKey();
#ifdef TO_REMOVE
bool loadFromData(const QByteArray &data, KeyType type, KeyFormat format = PEM); bool loadFromData(const QByteArray &data, KeyType type, KeyFormat format = PEM);
bool loadFromFile(const QString &path, KeyType type, KeyFormat format = PEM); bool loadFromFile(const QString &path, KeyType type, KeyFormat format = PEM);
#endif
bool loadFromFile(const QString &path);
void clear(); void clear();
bool isLoaded() const { return d.data() && d->key != 0; } const QByteArray bytes() const { return key_data; }
bool loadFromTorMessage(const QByteArray& b);
bool isLoaded() const { return !key_data.isNull(); }
#ifdef TO_REMOVE
bool isPrivate() const; bool isPrivate() const;
QByteArray publicKeyDigest() const; QByteArray publicKeyDigest() const;
@ -76,8 +81,10 @@ public:
QByteArray signSHA256(const QByteArray &digest) const; QByteArray signSHA256(const QByteArray &digest) const;
// Verify a signature as per signSHA256 // Verify a signature as per signSHA256
bool verifySHA256(const QByteArray &digest, QByteArray signature) const; bool verifySHA256(const QByteArray &digest, QByteArray signature) const;
#endif
private: private:
#ifdef TO_REMOVE
struct Data : public QSharedData struct Data : public QSharedData
{ {
typedef struct rsa_st RSA; typedef struct rsa_st RSA;
@ -86,8 +93,12 @@ private:
Data(RSA *k = 0) : key(k) { } Data(RSA *k = 0) : key(k) { }
~Data(); ~Data();
}; };
#endif
QByteArray key_data;
#ifdef TO_REMOVE
QExplicitlySharedDataPointer<Data> d; QExplicitlySharedDataPointer<Data> d;
#endif
}; };
QByteArray torControlHashedPassword(const QByteArray &password); QByteArray torControlHashedPassword(const QByteArray &password);

View file

@ -90,6 +90,13 @@ void HiddenService::addTarget(quint16 servicePort, QHostAddress targetAddress, q
m_targets.append(t); 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) void HiddenService::setPrivateKey(const CryptoKey &key)
{ {
if (m_privateKey.isLoaded()) { if (m_privateKey.isLoaded()) {
@ -97,13 +104,15 @@ void HiddenService::setPrivateKey(const CryptoKey &key)
return; return;
} }
#ifdef TO_REMOVE
if (!key.isPrivate()) { if (!key.isPrivate()) {
BUG() << "Cannot create a hidden service with a public key"; BUG() << "Cannot create a hidden service with a public key";
return; return;
} }
#endif
m_privateKey = key; m_privateKey = key;
m_hostname = m_privateKey.torServiceID() + QStringLiteral(".onion");
emit privateKeyChanged(); emit privateKeyChanged();
} }
@ -112,13 +121,13 @@ void HiddenService::loadPrivateKey()
if (m_privateKey.isLoaded() || m_dataPath.isEmpty()) if (m_privateKey.isLoaded() || m_dataPath.isEmpty())
return; 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) { if (!ok) {
qWarning() << "Failed to load hidden service key"; qWarning() << "Failed to load hidden service key";
return; return;
} }
m_hostname = m_privateKey.torServiceID();
emit privateKeyChanged(); emit privateKeyChanged();
} }

View file

@ -70,11 +70,13 @@ public:
Status status() const { return m_status; } Status status() const { return m_status; }
const QString &hostname() const { return m_hostname; } const QString& hostname() const { return m_hostname; }
const QString &dataPath() const { return m_dataPath; } const QString serviceId() const { return QString(m_service_id); }
const QString& dataPath() const { return m_dataPath; }
CryptoKey privateKey() { return m_privateKey; } CryptoKey privateKey() { return m_privateKey; }
void setPrivateKey(const CryptoKey &privateKey); void setPrivateKey(const CryptoKey &privateKey);
void setServiceId(const QByteArray& sid);
const QList<Target> &targets() const { return m_targets; } const QList<Target> &targets() const { return m_targets; }
void addTarget(const Target &target); void addTarget(const Target &target);
@ -84,6 +86,7 @@ signals:
void statusChanged(int newStatus, int oldStatus); void statusChanged(int newStatus, int oldStatus);
void serviceOnline(); void serviceOnline();
void privateKeyChanged(); void privateKeyChanged();
void hostnameChanged();
private slots: private slots:
void servicePublished(); void servicePublished();
@ -94,6 +97,7 @@ private:
QString m_hostname; QString m_hostname;
Status m_status; Status m_status;
CryptoKey m_privateKey; CryptoKey m_privateKey;
QByteArray m_service_id;
void loadPrivateKey(); void loadPrivateKey();
void setStatus(Status newStatus); void setStatus(Status newStatus);

View file

@ -174,17 +174,16 @@ bool TorManager::setupHiddenService()
std::cerr << "Attempting to load key from legacy filesystem format in " << legacyDir.toStdString() << std::endl; std::cerr << "Attempting to load key from legacy filesystem format in " << legacyDir.toStdString() << std::endl;
CryptoKey key; CryptoKey key;
if (!key.loadFromFile(legacyDir + QLatin1String("/private_key"), CryptoKey::PrivateKey)) if (!key.loadFromFile(legacyDir + QLatin1String("/private_key")))
{ {
qWarning() << "Cannot load legacy format key from" << legacyDir << "for conversion"; qWarning() << "Cannot load legacy format key from" << legacyDir << "for conversion";
return false; return false;
} }
keyData = QString::fromLatin1(key.encodedPrivateKey(CryptoKey::DER).toBase64());
d->hiddenService = new Tor::HiddenService(key, legacyDir, this); d->hiddenService = new Tor::HiddenService(key, legacyDir, this);
std::cerr << "Got key from legacy dir: " << std::endl; std::cerr << "Got key from legacy dir: " << std::endl;
std::cerr << keyData.toStdString() << std::endl; std::cerr << key.bytes().toStdString() << std::endl;
} }
else else
{ {
@ -193,6 +192,7 @@ bool TorManager::setupHiddenService()
std::cerr << "Creating new hidden service." << std::endl; std::cerr << "Creating new hidden service." << std::endl;
connect(d->hiddenService, SIGNAL(privateKeyChanged()), this, SLOT(hiddenServicePrivateKeyChanged())) ; connect(d->hiddenService, SIGNAL(privateKeyChanged()), this, SLOT(hiddenServicePrivateKeyChanged())) ;
connect(d->hiddenService, SIGNAL(hostnameChanged()), this, SLOT(hiddenServiceHostnameChanged())) ;
} }
Q_ASSERT(d->hiddenService); Q_ASSERT(d->hiddenService);
@ -230,31 +230,40 @@ void TorManager::hiddenServiceStatusChanged(int old_status,int new_status)
void TorManager::hiddenServicePrivateKeyChanged() void TorManager::hiddenServicePrivateKeyChanged()
{ {
QString key = QString::fromLatin1(d->hiddenService->privateKey().encodedPrivateKey(CryptoKey::DER).toBase64()); QString key = QString::fromLatin1(d->hiddenService->privateKey().bytes());
QFile outfile(d->hiddenServiceDir + QLatin1String("/private_key")) ; QFile outfile(d->hiddenServiceDir + QLatin1String("/private_key")) ;
outfile.open( QIODevice::WriteOnly | QIODevice::Text ); outfile.open( QIODevice::WriteOnly | QIODevice::Text );
QTextStream s(&outfile); QTextStream s(&outfile);
#ifdef TO_REMOVE
s << "-----BEGIN RSA PRIVATE KEY-----" << endl; s << "-----BEGIN RSA PRIVATE KEY-----" << endl;
for(uint32_t i=0;i<key.length();i+=64) for(int i=0;i<key.length();i+=64)
s << key.mid(i,64) << endl ; s << key.mid(i,64) << endl ;
s << "-----END RSA PRIVATE KEY-----" << endl; s << "-----END RSA PRIVATE KEY-----" << endl;
#endif
s << key ;
outfile.close(); outfile.close();
std::cerr << "Hidden service private key changed!" << std::endl; std::cerr << "Hidden service private key changed!" << std::endl;
std::cerr << key.toStdString() << std::endl; std::cerr << key.toStdString() << std::endl;
}
void TorManager::hiddenServiceHostnameChanged()
{
QFile outfile2(d->hiddenServiceDir + QLatin1String("/hostname")) ; QFile outfile2(d->hiddenServiceDir + QLatin1String("/hostname")) ;
outfile2.open( QIODevice::WriteOnly | QIODevice::Text ); outfile2.open( QIODevice::WriteOnly | QIODevice::Text );
QTextStream t(&outfile2); QTextStream t(&outfile2);
t << d->hiddenService->hostname() << endl; QString hostname(d->hiddenService->hostname());
t << hostname << endl;
outfile2.close(); outfile2.close();
std::cerr << "Hidden service hostname changed: " << hostname.toStdString() << std::endl;
} }
bool TorManager::configurationNeeded() const bool TorManager::configurationNeeded() const
@ -381,7 +390,7 @@ bool TorManager::getHiddenServiceInfo(QString& service_id,QString& service_onion
for(auto it(hidden_services.begin());it!=hidden_services.end();++it) for(auto it(hidden_services.begin());it!=hidden_services.end();++it)
{ {
service_onion_address = (*it)->hostname(); service_onion_address = (*it)->hostname();
service_id = (*it)->privateKey().torServiceID(); service_id = (*it)->serviceId();
for(auto it2((*it)->targets().begin());it2!=(*it)->targets().end();++it2) for(auto it2((*it)->targets().begin());it2!=(*it)->targets().end();++it2)
{ {

View file

@ -93,6 +93,7 @@ public slots:
private slots: private slots:
void hiddenServicePrivateKeyChanged(); void hiddenServicePrivateKeyChanged();
void hiddenServiceHostnameChanged();
void hiddenServiceStatusChanged(int old_status,int new_status); void hiddenServiceStatusChanged(int old_status,int new_status);
signals: signals:

View file

@ -189,8 +189,6 @@ void HomePage::updateOwnCert()
void HomePage::updateOwnId() void HomePage::updateOwnId()
{ {
bool include_extra_locators = mIncludeAllIPs;
RsPeerDetails detail; RsPeerDetails detail;
if (!rsPeers->getPeerDetails(rsPeers->getOwnId(), detail)) if (!rsPeers->getPeerDetails(rsPeers->getOwnId(), detail))
@ -199,10 +197,29 @@ void HomePage::updateOwnId()
return ; return ;
} }
bool include_extra_locators = mIncludeAllIPs || detail.isHiddenNode;
std::string invite ; std::string invite ;
rsPeers->getShortInvite(invite,rsPeers->getOwnId(),true,!mIncludeAllIPs); rsPeers->getShortInvite(invite,rsPeers->getOwnId(),true,!include_extra_locators);
#ifdef TODO
QString S;
QString txt;
int i=0;
for(uint32_t i=0;i<invite.size();)
if(QFontMetricsF(font()).width(S) < ui->retroshareid->width())
S += invite[i++];
else
{
txt += S + "\n";
S.clear();
}
txt += S;
ui->retroshareid->setText(txt);
#endif
ui->retroshareid->setText(QString::fromUtf8(invite.c_str())); ui->retroshareid->setText(QString::fromUtf8(invite.c_str()));
} }
static void sendMail(QString sAddress, QString sSubject, QString sBody) static void sendMail(QString sAddress, QString sSubject, QString sBody)

View file

@ -174,7 +174,7 @@ private and secure decentralized communication platform.
<string>...</string> <string>...</string>
</property> </property>
<property name="icon"> <property name="icon">
<iconset resource="images.qrc"> <iconset resource="icons.qrc">
<normaloff>:/icons/help_64.png</normaloff>:/icons/help_64.png</iconset> <normaloff>:/icons/help_64.png</normaloff>:/icons/help_64.png</iconset>
</property> </property>
<property name="checkable"> <property name="checkable">
@ -186,22 +186,16 @@ private and secure decentralized communication platform.
</widget> </widget>
</item> </item>
<item row="1" column="4"> <item row="1" column="4">
<widget class="QToolButton" name="shareButton"> <widget class="QToolButton" name="expandButton">
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Preferred">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="focusPolicy">
<enum>Qt::NoFocus</enum>
</property>
<property name="toolTip"> <property name="toolTip">
<string>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;Share your RetroShare ID&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string> <string>Show full certificate (old format)</string>
</property>
<property name="text">
<string>...</string>
</property> </property>
<property name="icon"> <property name="icon">
<iconset resource="icons.qrc"> <iconset resource="icons.qrc">
<normaloff>:/icons/svg/share.svg</normaloff>:/icons/svg/share.svg</iconset> <normaloff>:/icons/png/cert.png</normaloff>:/icons/png/cert.png</iconset>
</property> </property>
<property name="iconSize"> <property name="iconSize">
<size> <size>
@ -209,8 +203,8 @@ private and secure decentralized communication platform.
<height>24</height> <height>24</height>
</size> </size>
</property> </property>
<property name="popupMode"> <property name="checkable">
<enum>QToolButton::InstantPopup</enum> <bool>true</bool>
</property> </property>
<property name="autoRaise"> <property name="autoRaise">
<bool>true</bool> <bool>true</bool>
@ -218,7 +212,7 @@ private and secure decentralized communication platform.
</widget> </widget>
</item> </item>
<item row="1" column="2"> <item row="1" column="2">
<widget class="QLabel" name="retroshareid"> <widget class="ElidedLabel" name="retroshareid">
<property name="font"> <property name="font">
<font> <font>
<pointsize>10</pointsize> <pointsize>10</pointsize>
@ -232,12 +226,36 @@ private and secure decentralized communication platform.
<property name="text"> <property name="text">
<string/> <string/>
</property> </property>
<property name="wordWrap">
<bool>false</bool>
</property>
<property name="textInteractionFlags"> <property name="textInteractionFlags">
<set>Qt::LinksAccessibleByMouse|Qt::TextSelectableByMouse</set> <set>Qt::LinksAccessibleByMouse|Qt::TextSelectableByMouse</set>
</property> </property>
</widget> </widget>
</item> </item>
<item row="3" column="0" colspan="5"> <item row="0" column="2">
<widget class="QLabel" name="userCertLabel">
<property name="sizePolicy">
<sizepolicy hsizetype="Expanding" vsizetype="Preferred">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="font">
<font>
<pointsize>11</pointsize>
</font>
</property>
<property name="text">
<string>This is your Retroshare ID. Copy and share with your friends!</string>
</property>
<property name="alignment">
<set>Qt::AlignLeading|Qt::AlignLeft|Qt::AlignVCenter</set>
</property>
</widget>
</item>
<item row="3" column="0" colspan="6">
<widget class="QPlainTextEdit" name="userCertEdit"> <widget class="QPlainTextEdit" name="userCertEdit">
<property name="sizePolicy"> <property name="sizePolicy">
<sizepolicy hsizetype="Expanding" vsizetype="Expanding"> <sizepolicy hsizetype="Expanding" vsizetype="Expanding">
@ -273,38 +291,23 @@ private and secure decentralized communication platform.
</property> </property>
</widget> </widget>
</item> </item>
<item row="0" column="2"> <item row="1" column="3">
<widget class="QLabel" name="userCertLabel"> <widget class="QToolButton" name="shareButton">
<property name="sizePolicy"> <property name="sizePolicy">
<sizepolicy hsizetype="Expanding" vsizetype="Preferred"> <sizepolicy hsizetype="Preferred" vsizetype="Preferred">
<horstretch>0</horstretch> <horstretch>0</horstretch>
<verstretch>0</verstretch> <verstretch>0</verstretch>
</sizepolicy> </sizepolicy>
</property> </property>
<property name="font"> <property name="focusPolicy">
<font> <enum>Qt::NoFocus</enum>
<pointsize>11</pointsize>
</font>
</property> </property>
<property name="text">
<string>This is your Retroshare ID. Copy and share with your friends!</string>
</property>
<property name="alignment">
<set>Qt::AlignLeading|Qt::AlignLeft|Qt::AlignVCenter</set>
</property>
</widget>
</item>
<item row="1" column="3">
<widget class="QToolButton" name="expandButton">
<property name="toolTip"> <property name="toolTip">
<string>Show full certificate (old format)</string> <string>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;Share your RetroShare ID&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
</property>
<property name="text">
<string>...</string>
</property> </property>
<property name="icon"> <property name="icon">
<iconset resource="icons.qrc"> <iconset resource="icons.qrc">
<normaloff>:/icons/png/cert.png</normaloff>:/icons/png/cert.png</iconset> <normaloff>:/icons/svg/share.svg</normaloff>:/icons/svg/share.svg</iconset>
</property> </property>
<property name="iconSize"> <property name="iconSize">
<size> <size>
@ -312,8 +315,8 @@ private and secure decentralized communication platform.
<height>24</height> <height>24</height>
</size> </size>
</property> </property>
<property name="checkable"> <property name="popupMode">
<bool>true</bool> <enum>QToolButton::InstantPopup</enum>
</property> </property>
<property name="autoRaise"> <property name="autoRaise">
<bool>true</bool> <bool>true</bool>
@ -337,9 +340,17 @@ private and secure decentralized communication platform.
</item> </item>
</layout> </layout>
</widget> </widget>
<customwidgets>
<customwidget>
<class>ElidedLabel</class>
<extends>QLabel</extends>
<header location="global">gui/common/ElidedLabel.h</header>
<container>1</container>
</customwidget>
</customwidgets>
<resources> <resources>
<include location="images.qrc"/>
<include location="icons.qrc"/> <include location="icons.qrc"/>
<include location="images.qrc"/>
</resources> </resources>
<connections/> <connections/>
</ui> </ui>

View file

@ -278,7 +278,7 @@ void ConfCertDialog::loadInvitePage()
if(ui._shortFormat_CB->isChecked()) if(ui._shortFormat_CB->isChecked())
{ {
rsPeers->getShortInvite(invite,detail.id,true,!ui._includeIPHistory_CB->isChecked() ); rsPeers->getShortInvite(invite,detail.id,true,!(ui._includeIPHistory_CB->isChecked()|| detail.isHiddenNode) );
ui.stabWidget->setTabText(1, tr("Retroshare ID")); ui.stabWidget->setTabText(1, tr("Retroshare ID"));
} }
else else