mods to support hidden nodes, and hidden certificate sharing.

git-svn-id: http://svn.code.sf.net/p/retroshare/code/branches/v0.6-initdev@6721 b45a01b8-16f6-495d-af2f-9b41ad6348cc
This commit is contained in:
drbob 2013-09-09 02:11:43 +00:00
parent bfd915864b
commit 1d6f99de0d
7 changed files with 311 additions and 155 deletions

View File

@ -37,6 +37,7 @@ GenCertDialog::GenCertDialog(bool onlyGenerateIdentity, QWidget *parent)
ui.setupUi(this); ui.setupUi(this);
connect(ui.new_gpg_key_checkbox, SIGNAL(clicked()), this, SLOT(newGPGKeyGenUiSetup())); connect(ui.new_gpg_key_checkbox, SIGNAL(clicked()), this, SLOT(newGPGKeyGenUiSetup()));
connect(ui.hidden_checkbox, SIGNAL(clicked()), this, SLOT(hiddenUiSetup()));
connect(ui.genButton, SIGNAL(clicked()), this, SLOT(genPerson())); connect(ui.genButton, SIGNAL(clicked()), this, SLOT(genPerson()));
connect(ui.importIdentity_PB, SIGNAL(clicked()), this, SLOT(importIdentity())); connect(ui.importIdentity_PB, SIGNAL(clicked()), this, SLOT(importIdentity()));
@ -115,6 +116,7 @@ void GenCertDialog::init()
ui.headerLabel2->setText(text); ui.headerLabel2->setText(text);
newGPGKeyGenUiSetup(); newGPGKeyGenUiSetup();
hiddenUiSetup();
} }
void GenCertDialog::newGPGKeyGenUiSetup() { void GenCertDialog::newGPGKeyGenUiSetup() {
@ -153,6 +155,28 @@ void GenCertDialog::newGPGKeyGenUiSetup() {
} }
} }
void GenCertDialog::hiddenUiSetup()
{
if (ui.hidden_checkbox->isChecked())
{
ui.hiddenaddr_input->show();
ui.hiddenaddr_label->show();
ui.label_hiddenaddr2->show();
ui.hiddenport_label->show();
ui.hiddenport_spinBox->show();
}
else
{
ui.hiddenaddr_input->hide();
ui.hiddenaddr_label->hide();
ui.label_hiddenaddr2->hide();
ui.hiddenport_label->hide();
ui.hiddenport_spinBox->hide();
}
}
void GenCertDialog::exportIdentity() void GenCertDialog::exportIdentity()
{ {
QString fname = QFileDialog::getSaveFileName(this,tr("Export Identity"), "",tr("RetroShare Identity files (*.asc)")) ; QString fname = QFileDialog::getSaveFileName(this,tr("Export Identity"), "",tr("RetroShare Identity files (*.asc)")) ;
@ -203,6 +227,21 @@ void GenCertDialog::genPerson()
std::string genLoc = ui.location_input->text().toUtf8().constData(); std::string genLoc = ui.location_input->text().toUtf8().constData();
std::string PGPId; std::string PGPId;
if (ui.hidden_checkbox->isChecked())
{
std::string hl = ui.hiddenaddr_input->text().toStdString();
uint16_t port = ui.hiddenport_spinBox->value();
if (!RsInit::SetHiddenLocation(hl, port)) /* parses it */
{
/* Message Dialog */
QMessageBox::warning(this,
tr("Invalid Hidden Location"),
tr("Please put in a valid address of the form: 31769173498.onion:7800"),
QMessageBox::Ok);
return;
}
}
if (!genNewGPGKey) { if (!genNewGPGKey) {
if (genLoc.length() < 3) { if (genLoc.length() < 3) {
/* Message Dialog */ /* Message Dialog */

View File

@ -37,6 +37,7 @@ private slots:
void importIdentity(); void importIdentity();
void exportIdentity(); void exportIdentity();
void newGPGKeyGenUiSetup(); void newGPGKeyGenUiSetup();
void hiddenUiSetup();
private: private:
void init(); void init();

View File

@ -6,8 +6,8 @@
<rect> <rect>
<x>0</x> <x>0</x>
<y>0</y> <y>0</y>
<width>664</width> <width>618</width>
<height>474</height> <height>641</height>
</rect> </rect>
</property> </property>
<property name="windowTitle"> <property name="windowTitle">
@ -32,8 +32,8 @@
<height>30</height> <height>30</height>
</size> </size>
</property> </property>
<layout class="QGridLayout" name="gridLayout"> <layout class="QVBoxLayout" name="verticalLayout">
<item row="0" column="0"> <item>
<widget class="QLabel" name="label"> <widget class="QLabel" name="label">
<property name="font"> <property name="font">
<font> <font>
@ -48,23 +48,10 @@
</property> </property>
</widget> </widget>
</item> </item>
<item row="1" column="0"> <item>
<widget class="QGroupBox" name="groupBox"> <widget class="QGroupBox" name="groupBox">
<layout class="QGridLayout" name="gridLayout_2"> <layout class="QGridLayout" name="gridLayout">
<item row="9" column="0" colspan="2"> <item row="0" column="0" colspan="4">
<spacer name="verticalSpacer">
<property name="orientation">
<enum>Qt::Vertical</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>1</width>
<height>1</height>
</size>
</property>
</spacer>
</item>
<item row="0" column="0" colspan="2">
<widget class="QLabel" name="no_gpg_key_label"> <widget class="QLabel" name="no_gpg_key_label">
<property name="text"> <property name="text">
<string>It looks like you don't own any profile (PGP keys). Please fill in the form below to create one, or import an existing profile.</string> <string>It looks like you don't own any profile (PGP keys). Please fill in the form below to create one, or import an existing profile.</string>
@ -74,117 +61,7 @@
</property> </property>
</widget> </widget>
</item> </item>
<item row="2" column="1"> <item row="1" column="0" colspan="4">
<widget class="QComboBox" name="genPGPuser">
<property name="toolTip">
<string>Your profile is associated with a PGP key. RetroShare currently ignores DSA keys.</string>
</property>
</widget>
</item>
<item row="3" column="0">
<widget class="QLabel" name="name_label">
<property name="text">
<string>Name</string>
</property>
</widget>
</item>
<item row="3" column="1">
<widget class="QLineEdit" name="name_input">
<property name="toolTip">
<string>Enter your nickname here</string>
</property>
<property name="maxLength">
<number>64</number>
</property>
</widget>
</item>
<item row="5" column="0">
<widget class="QLabel" name="password_label">
<property name="toolTip">
<string>This Password is for PGP</string>
</property>
<property name="text">
<string>Password</string>
</property>
</widget>
</item>
<item row="5" column="1">
<widget class="QLineEdit" name="password_input">
<property name="toolTip">
<string>Put a strong password here. This password protects your PGP key.</string>
</property>
<property name="inputMask">
<string/>
</property>
<property name="maxLength">
<number>1024</number>
</property>
<property name="echoMode">
<enum>QLineEdit::Password</enum>
</property>
</widget>
</item>
<item row="6" column="0">
<widget class="QLabel" name="location_label">
<property name="text">
<string>Location</string>
</property>
</widget>
</item>
<item row="6" column="1">
<widget class="QLineEdit" name="location_input">
<property name="maxLength">
<number>64</number>
</property>
</widget>
</item>
<item row="7" column="1">
<widget class="QLabel" name="label_location2">
<property name="minimumSize">
<size>
<width>0</width>
<height>30</height>
</size>
</property>
<property name="lineWidth">
<number>1</number>
</property>
<property name="text">
<string>Put a meaningful location. ex : home, laptop, etc. This field will be used to differentiate different installations with the same identity (PGP key).</string>
</property>
<property name="scaledContents">
<bool>false</bool>
</property>
<property name="wordWrap">
<bool>true</bool>
</property>
</widget>
</item>
<item row="8" column="1">
<widget class="QPushButton" name="genButton">
<property name="maximumSize">
<size>
<width>16777215</width>
<height>26</height>
</size>
</property>
<property name="text">
<string>Create new identity</string>
</property>
<property name="icon">
<iconset resource="images.qrc">
<normaloff>:/images/contact_new.png</normaloff>:/images/contact_new.png</iconset>
</property>
</widget>
</item>
<item row="2" column="0">
<widget class="QLabel" name="genPGPuserlabel">
<property name="text">
<string>Use identity</string>
</property>
</widget>
</item>
<item row="1" column="0" colspan="2">
<layout class="QHBoxLayout" name="horizontalLayout_2" stretch="0,0,0,0"> <layout class="QHBoxLayout" name="horizontalLayout_2" stretch="0,0,0,0">
<property name="spacing"> <property name="spacing">
<number>6</number> <number>6</number>
@ -253,6 +130,37 @@
</item> </item>
</layout> </layout>
</item> </item>
<item row="2" column="0">
<widget class="QLabel" name="genPGPuserlabel">
<property name="text">
<string>Use identity</string>
</property>
</widget>
</item>
<item row="2" column="1" colspan="3">
<widget class="QComboBox" name="genPGPuser">
<property name="toolTip">
<string>Your profile is associated with a PGP key. RetroShare currently ignores DSA keys.</string>
</property>
</widget>
</item>
<item row="3" column="0">
<widget class="QLabel" name="name_label">
<property name="text">
<string>Name</string>
</property>
</widget>
</item>
<item row="3" column="1" colspan="3">
<widget class="QLineEdit" name="name_input">
<property name="toolTip">
<string>Enter your nickname here</string>
</property>
<property name="maxLength">
<number>64</number>
</property>
</widget>
</item>
<item row="4" column="0"> <item row="4" column="0">
<widget class="QLabel" name="email_label"> <widget class="QLabel" name="email_label">
<property name="text"> <property name="text">
@ -260,7 +168,7 @@
</property> </property>
</widget> </widget>
</item> </item>
<item row="4" column="1"> <item row="4" column="1" colspan="3">
<widget class="QLineEdit" name="email_input"> <widget class="QLineEdit" name="email_input">
<property name="toolTip"> <property name="toolTip">
<string>Be careful: this email will be visible to your friends and friends <string>Be careful: this email will be visible to your friends and friends
@ -272,6 +180,183 @@ anonymous, you can use a fake email.</string>
</property> </property>
</widget> </widget>
</item> </item>
<item row="5" column="0">
<widget class="QLabel" name="password_label">
<property name="toolTip">
<string>This Password is for PGP</string>
</property>
<property name="text">
<string>Password</string>
</property>
</widget>
</item>
<item row="5" column="1" colspan="3">
<widget class="QLineEdit" name="password_input">
<property name="toolTip">
<string>Put a strong password here. This password protects your PGP key.</string>
</property>
<property name="inputMask">
<string/>
</property>
<property name="maxLength">
<number>1024</number>
</property>
<property name="echoMode">
<enum>QLineEdit::Password</enum>
</property>
</widget>
</item>
<item row="6" column="0">
<widget class="QLabel" name="location_label">
<property name="text">
<string>Location</string>
</property>
</widget>
</item>
<item row="6" column="1" colspan="3">
<widget class="QLineEdit" name="location_input">
<property name="maxLength">
<number>64</number>
</property>
</widget>
</item>
<item row="7" column="1" colspan="3">
<widget class="QLabel" name="label_location2">
<property name="minimumSize">
<size>
<width>0</width>
<height>30</height>
</size>
</property>
<property name="lineWidth">
<number>1</number>
</property>
<property name="text">
<string>Put a meaningful location. ex : home, laptop, etc. This field will be used to differentiate different installations with the same identity (PGP key).</string>
</property>
<property name="scaledContents">
<bool>false</bool>
</property>
<property name="wordWrap">
<bool>true</bool>
</property>
</widget>
</item>
<item row="8" column="0" colspan="4">
<widget class="QCheckBox" name="hidden_checkbox">
<property name="maximumSize">
<size>
<width>16777215</width>
<height>32</height>
</size>
</property>
<property name="toolTip">
<string>Your profile is associated with a PGP key</string>
</property>
<property name="text">
<string>Create a Hidden Location.</string>
</property>
<property name="icon">
<iconset resource="images.qrc">
<normaloff>:/images/contact_new128.png</normaloff>:/images/contact_new128.png</iconset>
</property>
<property name="iconSize">
<size>
<width>32</width>
<height>32</height>
</size>
</property>
<property name="tristate">
<bool>false</bool>
</property>
</widget>
</item>
<item row="9" column="0">
<widget class="QLabel" name="hiddenaddr_label">
<property name="text">
<string>Tor Address</string>
</property>
</widget>
</item>
<item row="9" column="1">
<widget class="QLineEdit" name="hiddenaddr_input">
<property name="maxLength">
<number>64</number>
</property>
</widget>
</item>
<item row="9" column="2">
<widget class="QLabel" name="hiddenport_label">
<property name="text">
<string>Port</string>
</property>
</widget>
</item>
<item row="9" column="3">
<widget class="QSpinBox" name="hiddenport_spinBox">
<property name="minimum">
<number>1</number>
</property>
<property name="maximum">
<number>65535</number>
</property>
<property name="value">
<number>7812</number>
</property>
</widget>
</item>
<item row="10" column="1" colspan="3">
<widget class="QLabel" name="label_hiddenaddr2">
<property name="minimumSize">
<size>
<width>0</width>
<height>30</height>
</size>
</property>
<property name="lineWidth">
<number>1</number>
</property>
<property name="text">
<string>This is a TOR Onion address of the form: xa76giaf6ifda7ri63i263.onion and your selected port, you must first launch TOR and create a new hidden service to generate this address.</string>
</property>
<property name="scaledContents">
<bool>false</bool>
</property>
<property name="wordWrap">
<bool>true</bool>
</property>
</widget>
</item>
<item row="11" column="1" colspan="3">
<widget class="QPushButton" name="genButton">
<property name="maximumSize">
<size>
<width>16777215</width>
<height>26</height>
</size>
</property>
<property name="text">
<string>Create new identity</string>
</property>
<property name="icon">
<iconset resource="images.qrc">
<normaloff>:/images/contact_new.png</normaloff>:/images/contact_new.png</iconset>
</property>
</widget>
</item>
<item row="12" column="1">
<spacer name="verticalSpacer">
<property name="orientation">
<enum>Qt::Vertical</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>1</width>
<height>1</height>
</size>
</property>
</spacer>
</item>
</layout> </layout>
</widget> </widget>
</item> </item>

View File

@ -213,14 +213,28 @@ void ConfCertDialog::load()
else else
ui.crypto_info->setText(tr("Not connected")) ; ui.crypto_info->setText(tr("Not connected")) ;
/* set local address */ if (detail.isHiddenNode)
ui.localAddress->setText(QString::fromStdString(detail.localAddr)); {
ui.localPort -> setValue(detail.localPort); /* set local address */
/* set the server address */ ui.localAddress->setText("hidden");
ui.extAddress->setText(QString::fromStdString(detail.extAddr)); ui.localPort -> setValue(0);
ui.extPort -> setValue(detail.extPort); /* set the server address */
ui.extAddress->setText("hidden");
ui.extPort -> setValue(0);
ui.dynDNS->setText(QString::fromStdString(detail.dyndns)); ui.dynDNS->setText(QString::fromStdString(detail.hiddenNodeAddress));
}
else
{
/* set local address */
ui.localAddress->setText(QString::fromStdString(detail.localAddr));
ui.localPort -> setValue(detail.localPort);
/* set the server address */
ui.extAddress->setText(QString::fromStdString(detail.extAddr));
ui.extPort -> setValue(detail.extPort);
ui.dynDNS->setText(QString::fromStdString(detail.dyndns));
}
ui.statusline->setText(StatusDefs::connectStateString(detail)); ui.statusline->setText(StatusDefs::connectStateString(detail));

View File

@ -621,23 +621,33 @@ void ConnectFriendWizard::accept()
rsPeers->addFriend(peerDetails.id, peerDetails.gpg_id,serviceFlags()) ; rsPeers->addFriend(peerDetails.id, peerDetails.gpg_id,serviceFlags()) ;
runProgressDialog = true; runProgressDialog = true;
//let's check if there is ip adresses in the wizard.
if (!peerDetails.extAddr.empty() && peerDetails.extPort) {
std::cerr << "ConnectFriendWizard::accept() : setting ip ext address." << std::endl;
rsPeers->setExtAddress(peerDetails.id, peerDetails.extAddr, peerDetails.extPort);
}
if (!peerDetails.localAddr.empty() && peerDetails.localPort) {
std::cerr << "ConnectFriendWizard::accept() : setting ip local address." << std::endl;
rsPeers->setLocalAddress(peerDetails.id, peerDetails.localAddr, peerDetails.localPort);
}
if (!peerDetails.dyndns.empty()) {
std::cerr << "ConnectFriendWizard::accept() : setting DynDNS." << std::endl;
rsPeers->setDynDNS(peerDetails.id, peerDetails.dyndns);
}
if (!peerDetails.location.empty()) { if (!peerDetails.location.empty()) {
std::cerr << "ConnectFriendWizard::accept() : setting peerLocation." << std::endl; std::cerr << "ConnectFriendWizard::accept() : setting peerLocation." << std::endl;
rsPeers->setLocation(peerDetails.id, peerDetails.location); rsPeers->setLocation(peerDetails.id, peerDetails.location);
} }
if (peerDetails.isHiddenNode)
{
std::cerr << "ConnectFriendWizard::accept() : setting hidden node." << std::endl;
rsPeers->setHiddenNode(peerDetails.id, peerDetails.hiddenNodeAddress);
}
else
{
//let's check if there is ip adresses in the wizard.
if (!peerDetails.extAddr.empty() && peerDetails.extPort) {
std::cerr << "ConnectFriendWizard::accept() : setting ip ext address." << std::endl;
rsPeers->setExtAddress(peerDetails.id, peerDetails.extAddr, peerDetails.extPort);
}
if (!peerDetails.localAddr.empty() && peerDetails.localPort) {
std::cerr << "ConnectFriendWizard::accept() : setting ip local address." << std::endl;
rsPeers->setLocalAddress(peerDetails.id, peerDetails.localAddr, peerDetails.localPort);
}
if (!peerDetails.dyndns.empty()) {
std::cerr << "ConnectFriendWizard::accept() : setting DynDNS." << std::endl;
rsPeers->setDynDNS(peerDetails.id, peerDetails.dyndns);
}
}
} }
if (runProgressDialog) if (runProgressDialog)

View File

@ -147,6 +147,10 @@ void ServerPage::load()
int netIndex = 0; int netIndex = 0;
switch(detail.netMode) switch(detail.netMode)
{ {
case RS_NETMODE_HIDDEN:
netIndex = 3;
ui.netModeComboBox->setEnabled(false);
break;
case RS_NETMODE_EXT: case RS_NETMODE_EXT:
netIndex = 2; netIndex = 2;
break; break;

View File

@ -43,6 +43,11 @@
<string>Manually Forwarded Port</string> <string>Manually Forwarded Port</string>
</property> </property>
</item> </item>
<item>
<property name="text">
<string>Hidden Node</string>
</property>
</item>
</widget> </widget>
</item> </item>
<item> <item>
@ -369,8 +374,6 @@ behind a firewall or a VPN.</string>
<zorder>showDiscStatusBar</zorder> <zorder>showDiscStatusBar</zorder>
<zorder>allowIpDeterminationCB</zorder> <zorder>allowIpDeterminationCB</zorder>
<zorder>IPServersLV</zorder> <zorder>IPServersLV</zorder>
<zorder>textlabel_ext</zorder>
<zorder>textlabel_netLimited</zorder>
<zorder>ipAddressList</zorder> <zorder>ipAddressList</zorder>
<zorder>label_7</zorder> <zorder>label_7</zorder>
</widget> </widget>