Plugged-in method for removing signatures in PGP keys => now RS has small and constant-sized certificates.

- added checkbox in ConfCertDialog to allow adding/removing signatures
- enabled again key signature button in friend wizard
- RS cert links now use small keys.


git-svn-id: http://svn.code.sf.net/p/retroshare/code/trunk@4836 b45a01b8-16f6-495d-af2f-9b41ad6348cc
This commit is contained in:
csoler 2012-01-23 20:55:08 +00:00
parent fadc86b189
commit a8456a2332
5 changed files with 48 additions and 15 deletions

View File

@ -33,6 +33,7 @@
#include "pqi/pqinotify.h"
#include <util/rsdir.h>
#include <util/pgpkey.h>
#include <iostream>
#include <sstream>
#include <algorithm>
@ -1385,12 +1386,12 @@ bool AuthGPGimpl::isGPGAccepted(const std::string &id)
std::string AuthGPGimpl::SaveCertificateToString(const std::string &id,bool include_signatures)
{
if (!isGPGId(id)) {
std::cerr << "AuthGPGimpl::SaveCertificateToString() unknown ID" << std::endl;
return "";
if (!isGPGId(id)) {
std::cerr << "AuthGPGimpl::SaveCertificateToString() unknown ID" << std::endl;
return "";
}
RsStackMutex stack(gpgMtxEngine); /******* LOCKED ******/
RsStackMutex stack(gpgMtxEngine); /******* LOCKED ******/
std::string tmp;
const char *pattern[] = { NULL, NULL };
@ -1408,17 +1409,17 @@ std::string AuthGPGimpl::SaveCertificateToString(const std::string &id,bool incl
if (GPG_ERR_NO_ERROR != gpgme_data_new (&gpgmeData))
{
std::cerr << "Error create Data" << std::endl;
std::cerr << "Error create Data" << std::endl;
}
gpgme_set_armor (CTX, 1);
if (GPG_ERR_NO_ERROR != gpgme_op_export_ext (CTX, pattern, export_mode, gpgmeData))
{
std::cerr << "Error export Data" << std::endl;
std::cerr << "Error export Data" << std::endl;
}
fflush (NULL);
//showData (gpgmeData);
//showData (gpgmeData);
size_t len = 0;
char *export_txt = gpgme_data_release_and_get_mem(gpgmeData, &len);
@ -1432,12 +1433,19 @@ std::string AuthGPGimpl::SaveCertificateToString(const std::string &id,bool incl
delete[] str ;
#ifdef GPG_DEBUG
std::cerr << "Exported Certificate: " << std::endl << tmp << std::endl;
std::cerr << "Exported Certificate: " << std::endl << tmp << std::endl;
#endif
gpgme_free(export_txt);
return tmp;
// Try to remove signatures manually.
//
std::string cleaned_key ;
if( (!include_signatures) && PGPKeyManagement::createMinimalKey(tmp,cleaned_key))
return cleaned_key ;
else
return tmp;
}
/* import to GnuPG and other Certificates */

View File

@ -78,6 +78,7 @@ ConfCertDialog::ConfCertDialog(const std::string& id, QWidget *parent, Qt::WFlag
connect(ui.denyFriendButton, SIGNAL(clicked()), this, SLOT(denyFriend()));
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()));
#ifndef MINIMAL_RSGUI
MainWindow *w = MainWindow::getInstance();
@ -322,7 +323,23 @@ void ConfCertDialog::load()
}
ui.signers->setHtml(text);
std::string invite = rsPeers->GetRetroshareInvite(detail.id,true) ; // this needs to be a SSL id
loadInvitePage() ;
}
void ConfCertDialog::loadInvitePage()
{
RsPeerDetails detail;
if (!rsPeers->getPeerDetails(mId, detail))
{
QMessageBox::information(this,
tr("RetroShare"),
tr("Error : cannot get peer details."));
close();
return;
}
std::string invite = rsPeers->GetRetroshareInvite(detail.id,ui._shouldAddSignatures_CB->isChecked()) ; // this needs to be a SSL id
ui.userCertificateText->setReadOnly(true);
ui.userCertificateText->setMinimumHeight(200);

View File

@ -55,6 +55,7 @@ private slots:
void makeFriend();
void denyFriend();
void signGPGKey();
void loadInvitePage();
void showHelpDialog();
/** Called when a child window requests the given help <b>topic</b>. */

View File

@ -6,8 +6,8 @@
<rect>
<x>0</x>
<y>0</y>
<width>469</width>
<height>528</height>
<width>516</width>
<height>623</height>
</rect>
</property>
<property name="windowTitle">
@ -21,7 +21,7 @@
<item row="0" column="0">
<widget class="QTabWidget" name="stabWidget">
<property name="currentIndex">
<number>0</number>
<number>2</number>
</property>
<widget class="QWidget" name="tab">
<attribute name="icon">
@ -701,10 +701,17 @@ p, li { white-space: pre-wrap; }
<attribute name="title">
<string>Certificate</string>
</attribute>
<layout class="QHBoxLayout" name="horizontalLayout">
<layout class="QVBoxLayout" name="verticalLayout">
<item>
<widget class="QTextEdit" name="userCertificateText"/>
</item>
<item>
<widget class="QCheckBox" name="_shouldAddSignatures_CB">
<property name="text">
<string>Include signatures</string>
</property>
</widget>
</item>
</layout>
</widget>
</widget>

View File

@ -320,7 +320,7 @@ TextPage::TextPage(QWidget *parent)
userCertButtonsLayout = new QVBoxLayout();
userCertButtonsLayout->addWidget(userCertHelpButton);
if(rsPeers->hasExportMinimal())
// if(rsPeers->hasExportMinimal())
userCertButtonsLayout->addWidget(userCertIncludeSignaturesButton);
userCertButtonsLayout->addWidget(userCertCopyButton);