mirror of
https://github.com/RetroShare/RetroShare.git
synced 2025-02-01 01:55:50 -05:00
add random ssl password generation
git-svn-id: http://svn.code.sf.net/p/retroshare/code/trunk@1552 b45a01b8-16f6-495d-af2f-9b41ad6348cc
This commit is contained in:
parent
ee99a37502
commit
f36027185e
@ -110,8 +110,6 @@ void GenCertDialog::genPerson()
|
|||||||
std::string genOrg = ui.genOrg->text().toStdString();
|
std::string genOrg = ui.genOrg->text().toStdString();
|
||||||
std::string genLoc = ui.genLoc->text().toStdString();
|
std::string genLoc = ui.genLoc->text().toStdString();
|
||||||
std::string genCountry = ui.genCountry->text().toStdString();
|
std::string genCountry = ui.genCountry->text().toStdString();
|
||||||
std::string passwd = ui.genPasswd->text().toStdString();
|
|
||||||
std::string passwd2 = ui.genPasswd2->text().toStdString();
|
|
||||||
std::string err;
|
std::string err;
|
||||||
|
|
||||||
|
|
||||||
@ -149,38 +147,28 @@ void GenCertDialog::genPerson()
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ((passwd.length() >= 4) && (passwd == passwd2))
|
//generate a random ssl password
|
||||||
|
std::cerr << " generating sslPasswd." << std::endl;
|
||||||
|
qsrand(time(NULL));
|
||||||
|
std::string sslPasswd = "";
|
||||||
|
for( int i = 0 ; i < 6 ; ++i )
|
||||||
{
|
{
|
||||||
/* passwd passes basic test */
|
int iNumber;
|
||||||
}
|
iNumber = qrand()%25 + 65;
|
||||||
else
|
sslPasswd += (char)iNumber;
|
||||||
{
|
|
||||||
/* Message Dialog */
|
|
||||||
QMessageBox::StandardButton sb = QMessageBox::warning ( NULL,
|
|
||||||
"Generate ID Failure",
|
|
||||||
"Your password is too short, or don't match",
|
|
||||||
QMessageBox::Ok);
|
|
||||||
|
|
||||||
ui.genPasswd->setText("");
|
|
||||||
ui.genPasswd2->setText("");
|
|
||||||
|
|
||||||
return;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
#ifdef RS_USE_PGPSSL
|
|
||||||
/* Initialise the PGP user first */
|
/* Initialise the PGP user first */
|
||||||
RsInit::SelectGPGAccount(PGPId);
|
RsInit::SelectGPGAccount(PGPId);
|
||||||
RsInit::LoadGPGPassword(PGPpasswd);
|
RsInit::LoadGPGPassword(PGPpasswd);
|
||||||
#endif
|
|
||||||
|
|
||||||
std::string sslId;
|
std::string sslId;
|
||||||
bool okGen = RsInit::GenerateSSLCertificate(genName, genOrg, genLoc, genCountry, passwd, sslId, err);
|
bool okGen = RsInit::GenerateSSLCertificate(genName, genOrg, genLoc, genCountry, sslPasswd, sslId, err);
|
||||||
|
|
||||||
if (okGen)
|
if (okGen)
|
||||||
{
|
{
|
||||||
/* complete the process */
|
/* complete the process */
|
||||||
RsInit::LoadPassword(sslId, passwd);
|
RsInit::LoadPassword(sslId, sslPasswd);
|
||||||
loadCertificates();
|
loadCertificates();
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
Loading…
x
Reference in New Issue
Block a user