Exemplo n.º 1
0
SetPasswordDialog::~SetPasswordDialog()
{
   QString text;
   text = m_dialog.password1->text();
   OverwriteString(text);
   m_dialog.password1->setText(text);
   text = m_dialog.password2->text();
   OverwriteString(text);
   m_dialog.password2->setText(text);
}
Exemplo n.º 2
0
GetVaultKeyDialog::~GetVaultKeyDialog()
{
   QString text;
   text = m_dialog.password->text();
   OverwriteString(text);
   m_dialog.password->setText(text);
}
Exemplo n.º 3
0
void PasswordVault::initializeVaultKey()
{
   QString info("Setting the key for the Password Vault.\n"
                "Note: If you have server passwords saved in the Vault,\n"
                "these will no longer be valid and you will need to \n"
                "re-enter them in order to encrypt them with the new \n"
                "Vault Key.\n\n"
                "The Password Vault key is used to encrypt server\n"
                "passwords before being stored.  The key is not\n"
                "stored on file and must therefore be entered each\n"
                "time you restart IQmol.  If you forget your vault\n" 
                "key, you must reconfigure all the server settings\n"
                "saved in IQmol\n");

   SetPasswordDialog dialog(info, "Set Password Vault Key", "Vault Key" ); 

   if (dialog.exec() == QDialog::Accepted) {
      QString key(dialog.password());
      QLOG_INFO() << "Vault key accepted";

      delete m_enigmaMachine;
      m_enigmaMachine = new EnigmaMachine(key.toStdString());
      std::string hash(m_enigmaMachine->mdHash(key.toStdString()));
      OverwriteString(key);

      Preferences::ClearPasswordVaultContents();
      Preferences::PasswordVaultKey(QString::fromStdString(hash));
      Preferences::PasswordVaultSeed(m_enigmaMachine->seed());
   }
}
Exemplo n.º 4
0
QString PasswordVault::getServerPassword(QString const& server)
{
   QString password;
   if (unlock()) {
      QMap<QString, QString> vault(Preferences::PasswordVaultContents());
      password = vault.value(server);
      if (!password.isEmpty()) {
         std::string str(m_enigmaMachine->decrypt(password.toStdString()));
         password = QString::fromStdString(str);
         OverwriteString(str);
      }
      displayVaultContents();
   }else {
      QLOG_DEBUG() << "EnigmaMachine uninitialized";
   }
   return password;
}
Exemplo n.º 5
0
void GetVaultKeyDialog::verify()
{
   std::string key(m_dialog.password->text().toStdString());
   m_enigmaMachine = new EnigmaMachine(key, m_seed);

   QString hash(QString::fromStdString(m_enigmaMachine->mdHash(key)));
   OverwriteString(key);

   QLOG_DEBUG() << "Existing Vault Key" << m_hash;
   QLOG_DEBUG() << "Entered  Vault Key" << hash;

   if (hash == m_hash) {
      accept();
      QMsgBox::information(0, "IQmol", "Password Vault unlocked");
   }else {
      delete m_enigmaMachine;
      m_enigmaMachine = 0;
      QMsgBox::warning(0, "IQmol", "Passwords do not match");
   }
}
Exemplo n.º 6
0
bool RemoteHost::getPasswordFromUserAndConnect()
{
   QString msg("Password for ");
   QString password;
   msg += userName() + "@" + hostAddress();
   bool okPushed(true);
   bool connected(false);

   while (!connected) {
      password = QInputDialog::getText(0, "IQmol", msg, QLineEdit::Password, QString(), &okPushed); 
      if (okPushed) {
         connected = m_connection->connect(SecureConnection::Password, password);
         if (!connected) QMsgBox::warning(0, "IQmol", "Invalid password");
      }else {
         break;
      }
   }

   OverwriteString(password);
   return connected; 
}