added a tab to display the certificate of friends, in peer details

git-svn-id: http://svn.code.sf.net/p/retroshare/code/trunk@3439 b45a01b8-16f6-495d-af2f-9b41ad6348cc
This commit is contained in:
csoler 2010-09-03 19:23:24 +00:00
parent 1d957f3674
commit 180f833df3
5 changed files with 58 additions and 21 deletions

View File

@ -179,6 +179,7 @@ virtual bool getAllowServerIPDetermination() = 0 ;
virtual bool getAllowTunnelConnection() = 0 ;
/* Auth Stuff */
virtual std::string GetRetroshareInvite(const std::string& ssl_id) = 0;
virtual std::string GetRetroshareInvite() = 0;
virtual bool loadCertificateFromFile(std::string fname, std::string &ssl_id, std::string &gpg_id) = 0;

View File

@ -805,30 +805,42 @@ p3Peers::setVisState(std::string id, uint32_t extVisState)
/* Auth Stuff */
std::string
p3Peers::GetRetroshareInvite()
{
return GetRetroshareInvite(getOwnId());
}
std::string
p3Peers::GetRetroshareInvite(const std::string& ssl_id)
{
#ifdef P3PEERS_DEBUG
std::cerr << "p3Peers::GetRetroshareInvite()" << std::endl;
#endif
std::string invite = AuthGPG::getAuthGPG()->SaveCertificateToString(AuthGPG::getAuthGPG()->getGPGOwnId());
//add the sslid, location, ip local and external address after the signature
RsPeerDetails ownDetail;
if (getPeerDetails(rsPeers->getOwnId(), ownDetail)) {
invite += CERT_SSL_ID + ownDetail.id + ";";
invite += CERT_LOCATION + ownDetail.location + ";\n";
invite += CERT_LOCAL_IP + ownDetail.localAddr + ":";
std::ostringstream out;
out << ownDetail.localPort;
invite += out.str() + ";";
invite += CERT_EXT_IP + ownDetail.extAddr + ":";
std::ostringstream out2;
out2 << ownDetail.extPort;
invite += out2.str() + ";";
if (!ownDetail.dyndns.empty()) {
invite += "\n" + CERT_DYNDNS + ownDetail.dyndns + ";";
}
}
RsPeerDetails Detail;
std::string invite ;
if (getPeerDetails(ssl_id, Detail))
{
invite = AuthGPG::getAuthGPG()->SaveCertificateToString(Detail.gpg_id);
if(!Detail.isOnlyGPGdetail)
{
invite += CERT_SSL_ID + Detail.id + ";";
invite += CERT_LOCATION + Detail.location + ";\n";
invite += CERT_LOCAL_IP + Detail.localAddr + ":";
std::ostringstream out;
out << Detail.localPort;
invite += out.str() + ";";
invite += CERT_EXT_IP + Detail.extAddr + ":";
std::ostringstream out2;
out2 << Detail.extPort;
invite += out2.str() + ";";
if (!Detail.dyndns.empty()) {
invite += "\n" + CERT_DYNDNS + Detail.dyndns + ";";
}
}
}
#ifdef P3PEERS_DEBUG
std::cerr << "p3Peers::GetRetroshareInvite() returns : \n" << invite << std::endl;

View File

@ -87,6 +87,9 @@ virtual bool getAllowServerIPDetermination() ;
virtual bool getAllowTunnelConnection() ;
/* Auth Stuff */
// Get the invitation (GPG cert + local/ext address + SSL id for the given peer)
virtual std::string GetRetroshareInvite(const std::string& ssl_id);
// same but for own id
virtual std::string GetRetroshareInvite();
virtual bool loadCertificateFromFile(std::string fname, std::string &id, std::string &gpg_id);

View File

@ -305,6 +305,17 @@ void ConfCertDialog::loadDialog()
ui.signers_listWidget->addItem(QString::fromStdString(signerDetail.name) + " (" + QString::fromStdString(signerDetail.id) +")");
}
}
std::string invite = rsPeers->GetRetroshareInvite(detail.id) ; // this needs to be a SSL id
ui.userCertificateText->setReadOnly(true);
ui.userCertificateText->setMinimumHeight(200);
ui.userCertificateText->setMinimumWidth(530);
QFont font("Courier New",10,50,false);
font.setStyleHint(QFont::TypeWriter,QFont::PreferMatch);
font.setStyle(QFont::StyleNormal);
ui.userCertificateText->setFont(font);
ui.userCertificateText->setText(QString::fromStdString(invite));
}

View File

@ -6,8 +6,8 @@
<rect>
<x>0</x>
<y>0</y>
<width>489</width>
<height>505</height>
<width>516</width>
<height>606</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">
@ -580,6 +580,16 @@
</item>
</layout>
</widget>
<widget class="QWidget" name="tab_3">
<attribute name="title">
<string>Certificate</string>
</attribute>
<layout class="QHBoxLayout" name="horizontalLayout">
<item>
<widget class="QTextEdit" name="userCertificateText"/>
</item>
</layout>
</widget>
</widget>
</item>
<item row="1" column="0">