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);
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.importIdentity_PB, SIGNAL(clicked()), this, SLOT(importIdentity()));
@ -115,6 +116,7 @@ void GenCertDialog::init()
ui.headerLabel2->setText(text);
newGPGKeyGenUiSetup();
hiddenUiSetup();
}
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()
{
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 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 (genLoc.length() < 3) {
/* Message Dialog */

View File

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

View File

@ -6,8 +6,8 @@
<rect>
<x>0</x>
<y>0</y>
<width>664</width>
<height>474</height>
<width>618</width>
<height>641</height>
</rect>
</property>
<property name="windowTitle">
@ -32,8 +32,8 @@
<height>30</height>
</size>
</property>
<layout class="QGridLayout" name="gridLayout">
<item row="0" column="0">
<layout class="QVBoxLayout" name="verticalLayout">
<item>
<widget class="QLabel" name="label">
<property name="font">
<font>
@ -48,23 +48,10 @@
</property>
</widget>
</item>
<item row="1" column="0">
<item>
<widget class="QGroupBox" name="groupBox">
<layout class="QGridLayout" name="gridLayout_2">
<item row="9" column="0" colspan="2">
<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">
<layout class="QGridLayout" name="gridLayout">
<item row="0" column="0" colspan="4">
<widget class="QLabel" name="no_gpg_key_label">
<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>
@ -74,117 +61,7 @@
</property>
</widget>
</item>
<item row="2" column="1">
<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">
<item row="1" column="0" colspan="4">
<layout class="QHBoxLayout" name="horizontalLayout_2" stretch="0,0,0,0">
<property name="spacing">
<number>6</number>
@ -253,6 +130,37 @@
</item>
</layout>
</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">
<widget class="QLabel" name="email_label">
<property name="text">
@ -260,7 +168,7 @@
</property>
</widget>
</item>
<item row="4" column="1">
<item row="4" column="1" colspan="3">
<widget class="QLineEdit" name="email_input">
<property name="toolTip">
<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>
</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" 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>
</widget>
</item>

View File

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

View File

@ -621,6 +621,18 @@ void ConnectFriendWizard::accept()
rsPeers->addFriend(peerDetails.id, peerDetails.gpg_id,serviceFlags()) ;
runProgressDialog = true;
if (!peerDetails.location.empty()) {
std::cerr << "ConnectFriendWizard::accept() : setting peerLocation." << std::endl;
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;
@ -634,10 +646,8 @@ void ConnectFriendWizard::accept()
std::cerr << "ConnectFriendWizard::accept() : setting DynDNS." << std::endl;
rsPeers->setDynDNS(peerDetails.id, peerDetails.dyndns);
}
if (!peerDetails.location.empty()) {
std::cerr << "ConnectFriendWizard::accept() : setting peerLocation." << std::endl;
rsPeers->setLocation(peerDetails.id, peerDetails.location);
}
}
if (runProgressDialog)

View File

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

View File

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