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();
}
示例#2
0
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;
}
示例#3
0
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;
}
示例#4
0
文件: sslclient.cpp 项目: RSATom/Qt
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();
}
示例#5
0
文件: sslclient.cpp 项目: BGmot/Qt
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());
}
示例#7
0
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();
}
示例#8
0
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;

}