mirror of
https://github.com/RetroShare/RetroShare.git
synced 2025-11-29 11:56:37 -05:00
- added new certificate format in ConfCertDialog and ConnectFriendWizard, with a button to switch to old format if necessary
- added automatic cleaning of certificates in both formats - grouped all certificate cleaning/parsing code in rscertificate.cc - removed unused files cleanupxpgp.h/cc - added upper/lower case to rsid template. The new format is to be tested. It is supposed to be much more robust than the previous format, in particular, allowing any string for location names. git-svn-id: http://svn.code.sf.net/p/retroshare/code/trunk@5410 b45a01b8-16f6-495d-af2f-9b41ad6348cc
This commit is contained in:
parent
64e171948c
commit
60f51c358c
21 changed files with 1037 additions and 1099 deletions
|
|
@ -75,6 +75,7 @@ ConfCertDialog::ConfCertDialog(const std::string& id, QWidget *parent, Qt::WFlag
|
|||
connect(ui.signKeyButton, SIGNAL(clicked()), this, SLOT(signGPGKey()));
|
||||
connect(ui.trusthelpButton, SIGNAL(clicked()), this, SLOT(showHelpDialog()));
|
||||
connect(ui._shouldAddSignatures_CB, SIGNAL(toggled(bool)), this, SLOT(loadInvitePage()));
|
||||
connect(ui._useOldFormat_CB, SIGNAL(toggled(bool)), this, SLOT(loadInvitePage()));
|
||||
|
||||
MainWindow *w = MainWindow::getInstance();
|
||||
if (w) {
|
||||
|
|
@ -343,8 +344,7 @@ void ConfCertDialog::loadInvitePage()
|
|||
return;
|
||||
}
|
||||
|
||||
|
||||
std::string invite = rsPeers->GetRetroshareInvite(detail.id,ui._shouldAddSignatures_CB->isChecked()) ; // this needs to be a SSL id
|
||||
std::string invite = rsPeers->GetRetroshareInvite(detail.id,ui._shouldAddSignatures_CB->isChecked(),ui._useOldFormat_CB->isChecked()) ; // this needs to be a SSL id
|
||||
|
||||
ui.userCertificateText->setReadOnly(true);
|
||||
ui.userCertificateText->setMinimumHeight(200);
|
||||
|
|
|
|||
|
|
@ -18,6 +18,46 @@
|
|||
<normaloff>:/images/rstray3.png</normaloff>:/images/rstray3.png</iconset>
|
||||
</property>
|
||||
<layout class="QGridLayout" name="gridLayout">
|
||||
<item row="1" column="0">
|
||||
<layout class="QGridLayout" name="_12">
|
||||
<item row="0" column="0">
|
||||
<spacer>
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>311</width>
|
||||
<height>20</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
<item row="0" column="2">
|
||||
<widget class="QPushButton" name="applyButton">
|
||||
<property name="toolTip">
|
||||
<string>Apply and Close</string>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>OK</string>
|
||||
</property>
|
||||
<property name="autoDefault">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
<property name="default">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="1">
|
||||
<widget class="QPushButton" name="cancelButton">
|
||||
<property name="text">
|
||||
<string>Cancel</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item row="0" column="0">
|
||||
<widget class="QTabWidget" name="stabWidget">
|
||||
<property name="currentIndex">
|
||||
|
|
@ -376,7 +416,7 @@
|
|||
<number>0</number>
|
||||
</property>
|
||||
<item>
|
||||
<widget class="AvatarWidget" name="avatar" native="true">
|
||||
<widget class="AvatarWidget" name="avatar">
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>96</width>
|
||||
|
|
@ -699,56 +739,40 @@ p, li { white-space: pre-wrap; }
|
|||
<widget class="QTextEdit" name="userCertificateText"/>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QCheckBox" name="_shouldAddSignatures_CB">
|
||||
<property name="text">
|
||||
<string>Include signatures</string>
|
||||
</property>
|
||||
</widget>
|
||||
<layout class="QHBoxLayout" name="horizontalLayout">
|
||||
<item>
|
||||
<widget class="QCheckBox" name="_shouldAddSignatures_CB">
|
||||
<property name="text">
|
||||
<string>Include signatures</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QCheckBox" name="_useOldFormat_CB">
|
||||
<property name="text">
|
||||
<string>Use old key format</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<spacer name="horizontalSpacer_2">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>40</width>
|
||||
<height>20</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="0">
|
||||
<layout class="QGridLayout" name="_12">
|
||||
<item row="0" column="0">
|
||||
<spacer>
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>311</width>
|
||||
<height>20</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
<item row="0" column="2">
|
||||
<widget class="QPushButton" name="applyButton">
|
||||
<property name="toolTip">
|
||||
<string>Apply and Close</string>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>OK</string>
|
||||
</property>
|
||||
<property name="autoDefault">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
<property name="default">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="1">
|
||||
<widget class="QPushButton" name="cancelButton">
|
||||
<property name="text">
|
||||
<string>Cancel</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
<customwidgets>
|
||||
|
|
|
|||
|
|
@ -105,7 +105,8 @@ void ConnectFriendWizard::setCertificate(const QString &certificate)
|
|||
|
||||
std::string error_string;
|
||||
|
||||
if (rsPeers->loadDetailsFromStringCert(certificate.toUtf8().constData(), peerDetails, error_string)) {
|
||||
if (rsPeers->loadDetailsFromStringCert(certificate.toUtf8().constData(), peerDetails, error_string))
|
||||
{
|
||||
#ifdef FRIEND_WIZARD_DEBUG
|
||||
std::cerr << "ConnectFriendWizard got id : " << peerDetails.id << "; gpg_id : " << peerDetails.gpg_id << std::endl;
|
||||
#endif
|
||||
|
|
@ -131,6 +132,7 @@ void ConnectFriendWizard::initializePage(int id)
|
|||
case Page_Text:
|
||||
connect(ui->userCertHelpButton, SIGNAL( clicked()), this, SLOT(showHelpUserCert()));
|
||||
connect(ui->userCertIncludeSignaturesButton, SIGNAL(clicked()), this, SLOT(toggleSignatureState()));
|
||||
connect(ui->userCertOldFormatButton, SIGNAL(clicked()), this, SLOT(toggleFormatState()));
|
||||
connect(ui->userCertCopyButton, SIGNAL(clicked()), this, SLOT(copyCert()));
|
||||
connect(ui->userCertSaveButton, SIGNAL(clicked()), this, SLOT(saveCert()));
|
||||
connect(ui->userCertMailButton, SIGNAL(clicked()), this, SLOT(runEmailClient()));
|
||||
|
|
@ -412,6 +414,19 @@ void ConnectFriendWizard::accept()
|
|||
bool sign = ui->signGPGCheckBox->isChecked();
|
||||
bool accept_connection = ui->acceptNoSignGPGCheckBox->isChecked();
|
||||
|
||||
if(accept_connection || sign)
|
||||
{
|
||||
std::string certstr = ui->friendCertEdit->toPlainText().toUtf8().constData();
|
||||
|
||||
std::string ssl_id, pgp_id ;
|
||||
|
||||
if(!rsPeers->loadCertificateFromString(certstr,ssl_id,pgp_id))
|
||||
{
|
||||
std::cerr << "ConnectFriendWizard::accept(): cannot load that certificate." << std::endl;
|
||||
return ;
|
||||
}
|
||||
}
|
||||
|
||||
if (!peerDetails.gpg_id.empty()) {
|
||||
if (sign) {
|
||||
std::cerr << "ConclusionPage::validatePage() signing GPG key." << std::endl;
|
||||
|
|
@ -457,13 +472,27 @@ void ConnectFriendWizard::accept()
|
|||
|
||||
void ConnectFriendWizard::updateOwnCert()
|
||||
{
|
||||
std::string invite = rsPeers->GetRetroshareInvite(ui->userCertIncludeSignaturesButton->isChecked());
|
||||
std::string invite = rsPeers->GetRetroshareInvite(ui->userCertIncludeSignaturesButton->isChecked(),ui->userCertOldFormatButton->isChecked());
|
||||
|
||||
std::cerr << "TextPage() getting Invite: " << invite << std::endl;
|
||||
|
||||
ui->userCertEdit->setPlainText(QString::fromUtf8(invite.c_str()));
|
||||
}
|
||||
void ConnectFriendWizard::toggleFormatState()
|
||||
{
|
||||
if (ui->userCertOldFormatButton->isChecked())
|
||||
{
|
||||
ui->userCertOldFormatButton->setToolTip(tr("Use new certificate format (safer, more robust)"));
|
||||
ui->userCertOldFormatButton->setIcon(QIcon(":/images/ledoff1.png")) ;
|
||||
}
|
||||
else
|
||||
{
|
||||
ui->userCertOldFormatButton->setToolTip(tr("Use old (backward compatible) certificate format"));
|
||||
ui->userCertOldFormatButton->setIcon(QIcon(":/images/ledon1.png")) ;
|
||||
}
|
||||
|
||||
updateOwnCert();
|
||||
}
|
||||
void ConnectFriendWizard::toggleSignatureState()
|
||||
{
|
||||
if (ui->userCertIncludeSignaturesButton->isChecked()) {
|
||||
|
|
@ -508,6 +537,8 @@ void ConnectFriendWizard::cleanFriendCert()
|
|||
}
|
||||
QMessageBox::information(NULL, tr("Certificate cleaning error"), msg) ;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -45,6 +45,7 @@ private slots:
|
|||
/* TextPage */
|
||||
void updateOwnCert();
|
||||
void toggleSignatureState();
|
||||
void toggleFormatState();
|
||||
void runEmailClient();
|
||||
void showHelpUserCert();
|
||||
void copyCert();
|
||||
|
|
|
|||
|
|
@ -6,8 +6,8 @@
|
|||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>454</width>
|
||||
<height>370</height>
|
||||
<width>572</width>
|
||||
<height>517</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="windowTitle">
|
||||
|
|
@ -76,7 +76,7 @@
|
|||
<attribute name="pageId">
|
||||
<string notr="true">ConnectFriendWizard::Page_Text</string>
|
||||
</attribute>
|
||||
<layout class="QVBoxLayout" name="verticalLayout_2">
|
||||
<layout class="QVBoxLayout" name="verticalLayout_4">
|
||||
<item>
|
||||
<widget class="QLabel" name="userCertLabel">
|
||||
<property name="text">
|
||||
|
|
@ -91,6 +91,7 @@
|
|||
<property name="font">
|
||||
<font>
|
||||
<family>Courier New</family>
|
||||
<pointsize>10</pointsize>
|
||||
</font>
|
||||
</property>
|
||||
<property name="lineWrapMode">
|
||||
|
|
@ -99,10 +100,13 @@
|
|||
<property name="readOnly">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
<property name="tabStopWidth">
|
||||
<number>80</number>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<layout class="QVBoxLayout" name="verticalLayout_3">
|
||||
<layout class="QVBoxLayout" name="verticalLayout_2">
|
||||
<item>
|
||||
<widget class="QPushButton" name="userCertHelpButton">
|
||||
<property name="sizePolicy">
|
||||
|
|
@ -203,6 +207,42 @@
|
|||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QPushButton" name="userCertOldFormatButton">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Fixed" vsizetype="Fixed">
|
||||
<horstretch>20</horstretch>
|
||||
<verstretch>20</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="toolTip">
|
||||
<string>Run Email program</string>
|
||||
</property>
|
||||
<property name="icon">
|
||||
<iconset resource="../images.qrc">
|
||||
<normaloff>:/images/ledon1.png</normaloff>:/images/ledon1.png</iconset>
|
||||
</property>
|
||||
<property name="checkable">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
<property name="flat">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<spacer name="verticalSpacer_2">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Vertical</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>20</width>
|
||||
<height>40</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
</layout>
|
||||
|
|
@ -221,6 +261,7 @@
|
|||
<property name="font">
|
||||
<font>
|
||||
<family>Courier New</family>
|
||||
<pointsize>10</pointsize>
|
||||
</font>
|
||||
</property>
|
||||
<property name="lineWrapMode">
|
||||
|
|
@ -229,7 +270,7 @@
|
|||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<layout class="QVBoxLayout" name="verticalLayout_4">
|
||||
<layout class="QVBoxLayout" name="verticalLayout_3">
|
||||
<item>
|
||||
<widget class="QPushButton" name="friendCertCleanButton">
|
||||
<property name="sizePolicy">
|
||||
|
|
@ -250,6 +291,19 @@
|
|||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<spacer name="verticalSpacer">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Vertical</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>20</width>
|
||||
<height>40</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
</layout>
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue