void QgsAuthSslImportDialog::socketEncrypted() { QgsDebugMsg( "socketEncrypted entered" ); if ( !mSocket ) return; // might have disconnected already appendString( tr( "Socket ENCRYPTED" ) ); appendString( QStringLiteral( "%1: %2" ).arg( tr( "Protocol" ), QgsAuthCertUtils::getSslProtocolName( mSocket->protocol() ) ) ); QSslCipher ciph = mSocket->sessionCipher(); QString cipher = QStringLiteral( "%1: %2, %3 (%4/%5)" ) .arg( tr( "Session cipher" ), ciph.authenticationMethod(), ciph.name() ) .arg( ciph.usedBits() ).arg( ciph.supportedBits() ); appendString( cipher ); wdgtSslConfig->setEnabled( true ); QString hostport( QStringLiteral( "%1:%2" ).arg( mSocket->peerName() ).arg( mSocket->peerPort() ) ); wdgtSslConfig->setSslCertificate( mSocket->peerCertificate(), hostport.trimmed() ); if ( !mSslErrors.isEmpty() ) { wdgtSslConfig->appendSslIgnoreErrors( mSslErrors ); mSslErrors.clear(); } // checkCanSave(); // must come after last state change, or gets reverted leServer->setStyleSheet( QgsAuthGuiUtils::greenTextStyleSheet() ); destroySocket(); }
void SslClient::socketEncrypted() { QSslCipher ciph = ssl_->sessionCipher(); QString cipher = QString("%1, %2 (%3/%4)").arg(ciph.authenticationMethod()) .arg(ciph.name()).arg(ciph.usedBits()).arg(ciph.supportedBits()); CDebug() << "SSL cipher " << cipher; }
QDebug operator<<(QDebug debug, const QSslCipher &cipher) { debug << "QSslCipher(name=" << qPrintable(cipher.name()) << ", bits=" << cipher.usedBits() << ", proto=" << qPrintable(cipher.protocolString()) << ")"; return debug; }
QDebug operator<<(QDebug debug, const QSslCipher &cipher) { QDebugStateSaver saver(debug); debug.resetFormat().nospace().noquote(); debug << "QSslCipher(name=" << cipher.name() << ", bits=" << cipher.usedBits() << ", proto=" << cipher.protocolString() << ')'; return debug; }
QString dumpCipher(const QSslCipher &cipher) { QString s = "\n"; s += "Authentication: " + cipher.authenticationMethod() + "\n"; s += "Encryption: " + cipher.encryptionMethod() + "\n"; s += "Key Exchange: " + cipher.keyExchangeMethod() + "\n"; s += "Cipher Name: " + cipher.name() + "\n"; s += "Protocol: " + cipher.protocolString() + "\n"; s += "Supported Bits: " + QString(cipher.supportedBits()) + "\n"; s += "Used Bits: " + QString(cipher.usedBits()) + "\n"; return s; }
void SslClient::socketEncrypted() { form->sessionOutput->clear(); form->sessionInput->setFocus(); QPalette palette; palette.setColor(QPalette::Base, QColor(255, 255, 192)); form->hostNameEdit->setPalette(palette); const QSslCipher cipher = socket->sessionCipher(); const QString cipherInfo = QString("%1, %2 (%3/%4)").arg(cipher.authenticationMethod()) .arg(cipher.name()).arg(cipher.usedBits()) .arg(cipher.supportedBits());; form->cipherLabel->setText(cipherInfo); padLock->show(); }
void SslClient::socketEncrypted() { if (!socket) return; // might have disconnected already form->sessionOutput->clear(); form->sessionInput->setFocus(); QPalette palette; palette.setColor(QPalette::Base, QColor(255, 255, 192)); form->hostNameEdit->setPalette(palette); QSslCipher ciph = socket->sessionCipher(); QString cipher = QString("%1, %2 (%3/%4)").arg(ciph.authenticationMethod()) .arg(ciph.name()).arg(ciph.usedBits()).arg(ciph.supportedBits());; form->cipherLabel->setText(cipher); if (!padLock) { padLock = new QToolButton; padLock->setIcon(QIcon(":/encrypted.png")); #ifndef QT_NO_CURSOR padLock->setCursor(Qt::ArrowCursor); #endif padLock->setToolTip(tr("Display encryption details.")); int extent = form->hostNameEdit->height() - 2; padLock->resize(extent, extent); padLock->setSizePolicy(QSizePolicy::Fixed, QSizePolicy::Ignored); QHBoxLayout *layout = new QHBoxLayout(form->hostNameEdit); layout->setMargin(form->hostNameEdit->style()->pixelMetric(QStyle::PM_DefaultFrameWidth)); layout->setSpacing(0); layout->addStretch(); layout->addWidget(padLock); form->hostNameEdit->setLayout(layout); connect(padLock, SIGNAL(clicked()), this, SLOT(displayCertificateInfo())); } else { padLock->show(); } }
//! [3] void SslClient::socketEncrypted() { if (!m_socket) return; // Might have disconnected already // We started a new connection, so clear the response from previous connections m_response.clear(); emit responseChanged(); // Retrieve the information about the used cipher and update the property const QSslCipher cipher = m_socket->sessionCipher(); m_cipher = QString("%1, %2 (%3/%4)").arg(cipher.authenticationMethod()) .arg(cipher.name()) .arg(cipher.usedBits()) .arg(cipher.supportedBits()); emit cipherChanged(); // Tell the CertificateInfoControl about the certificate chain of this connection emit certificateChainChanged(m_socket->peerCertificateChain()); }
void SslButton::updateAccountInfo(Account *account) { if (!account || account->state() != Account::Connected) { setVisible(false); return; } else { setVisible(true); } if (account->url().scheme() == QLatin1String("https")) { setIcon(QIcon(QPixmap(":/mirall/resources/lock-https.png"))); QSslCipher cipher = account->sslConfiguration().sessionCipher(); setToolTip(tr("This connection is encrypted using %1 bit %2.\n").arg(cipher.usedBits()).arg(cipher.name())); QMenu *menu = new QMenu(this); QList<QSslCertificate> chain = account->sslConfiguration().peerCertificateChain(); menu->addAction(tr("Certificate information:"))->setEnabled(false); QList<QSslCertificate> tmpChain; foreach(QSslCertificate cert, chain) { tmpChain << cert; if (QSslSocket::systemCaCertificates().contains(cert)) break; }
void Server::connectionAccepted() { qDebug() << "SERVER: Now connected"; qDebug() << "SERVER: Connection is encrypted:" << clientConnection -> isEncrypted(); qDebug() << "SERVER: Socket Descriptor:" << clientConnection -> socketDescriptor(); QSslCipher ciph = clientConnection->sessionCipher(); QString cipher = QString("%1, %2 (%3/%4)").arg(ciph.authenticationMethod()).arg(ciph.name()).arg(ciph.usedBits()).arg(ciph.supportedBits()); qDebug() << "SERVER: Cipher:" << cipher; connected=1; emit readyToSendData(); }
QString Server :: getSSLCypher() { QString cipher(""); if(connected) //I know it's not pretty but it looks a lot better than a segfault :P if(clientConnection!=0) if(clientConnection -> isOpen()) { QSslCipher ciph = clientConnection->sessionCipher(); cipher = QString("%1, %2 (%3/%4)").arg(ciph.authenticationMethod()).arg(ciph.name()).arg(ciph.usedBits()).arg(ciph.supportedBits()); } return cipher; }