Skip to content
  • Problem with a QTcpSocket

    Unsolved General and Desktop
    14
    0 Votes
    14 Posts
    6k Views
    M

    I currently have a very similar problem. I'm implementing a send mail client which should gracefully fall back to an unencrypted connection if encryption fails (and the user has decided to go ahead anyway). For that purpose I've connected to the QAbstractSocket::error() signal.

    While I do get the signal it's ultimately moot since the code in question (QSslSocketBackendPrivate::startHandshake() in qsslsocket_openssl.cpp) immediately closes the socket by calling QSslSocket::abort() after emitting the signal. Because of that calling QSslSocket::ignoreSslErrors() is never an option.

    I currently have no workaround in place. Maybe the only solution is to connect to the disconnected() signal and then check whether the connection was closed because of a handshake error. If it was, then open a new unencrypted socket/connection. I'm open to suggestions, though... :-)

  • 0 Votes
    2 Posts
    3k Views
    O

    Fixed the problem:

    On Client-Side and on Server-Side i provide the following:

    Private key of the certificate Public key of the certificate Public key of the CA

    An connection is established. I am getting an SSLError: "The certificate is self-signed and untrusted", but i can either ignore it using ignoreSslErrors(); or the better method is by comparing the certificates to make sure it's all good.
    Also i have re-created my certificates and my CA with the correct information, because I haven't provided the CN for localhost since i was testing on my local machine with my old certificates.

    Anyways, the communication works with correct certificates.

  • how to download a file from ssl

    Solved General and Desktop
    16
    0 Votes
    16 Posts
    4k Views
    A

    @the_ I fixed this bug.
    Thank you.

  • 0 Votes
    8 Posts
    5k Views
    H

    I didn't.
    But also it didn't fixed the error.

    The QT client can connect to the server with wss.
    The Webclient can't connect to the server with wss. But an echo test to "wss://echo.websocket.org" is successfully, so the browser is okay. The question is, what's the difference between Qt secure websocket and the other solutions? Is it may some different SSL/TSL config?
    I'm using QSsl::TlsV1SslV3

  • 0 Votes
    2 Posts
    1k Views
    SGaistS

    Hi and welcome to devnet,

    Don't copy these DLLs, unless it has changed over time, Qt Creator is build with MSVC and you have a MinGW Qt build. You should rather get the official OpenSSL package and install that one to use with your application.

  • 0 Votes
    6 Posts
    5k Views
    SGaistS

    Self-signed certificate are always the more complicated to manage (i.e. nobody trust them since no valid CA validated them)

    Sorry, I'm don't remember of such a howto...

    No, there won't be another release of Qt 5.3. The next release is 5.6.0 the first LTS of Qt 5.

  • 0 Votes
    3 Posts
    2k Views
    SGaistS

    Hi,

    Glad you found out and thanks for sharing !

    Just a side note, you can now mark the thread as solved using the "Topic Tool" button. So there's no need to modify the title anymore.

  • Encrypting SQL connection

    Unsolved General and Desktop
    4
    0 Votes
    4 Posts
    2k Views
    SGaistS

    Hi,

    Since last version, the MySQL backend supports setting up SSL on the connection with CLIENT_SSL

    Hope it helps

  • 0 Votes
    5 Posts
    2k Views
    L

    It's been some time now. I don't remember exactly, but I think it was most likely from here:

    ftp://linorg.usp.br/mysql/Downloads/Connector-C/mysql-connector-c-6.1.5-src.zip

    It's one of the official mirrors.

  • 0 Votes
    3 Posts
    2k Views
    R

    @SGaist

    Thank you very much, I used the work-around they proposed
    (storing a copy of the certificate in the local resources of the app & adding that to the default CACertificate list before opening the socket)
    I'm afraid this won't be a clean long term solution though (the certificate will stay valid for a while, but eventually expires I guess).
    If anyone has any idea's for a more clean/permanent solution I'm very much open to suggestions.
    In the mean time this will have to do.
    Thanks again, I appreciate the comment

  • 0 Votes
    3 Posts
    3k Views
    S

    Hi,

    since I am convinced that somebody else will also have similar problems I wrote a tutorial how to create a multithreaded server:

    https://five-s.de/en/how-to-create-a-multithreaded-server-in-qt

    Best regards

  • 0 Votes
    1 Posts
    2k Views
    No one has replied
  • 0 Votes
    4 Posts
    4k Views
    D

    @koahnig I am using 2.0.1

  • 0 Votes
    4 Posts
    4k Views
    SGaistS

    You should also check the sslErrors signal

  • 0 Votes
    3 Posts
    2k Views
    SGaistS

    Hi,

    One alternative to consider is to rebuild Qt using the new Secure Transport backend for OS X.

  • 0 Votes
    3 Posts
    4k Views
    cybercatalystC

    Please this code from me where I did exactly this:
    https://github.com/cybercatalyst/qtwebserver/blob/master/tcp/tcpmultithreadedserver.cpp#L141

    void MultithreadedServer::setDefaultSslConfiguration() { // Set a default SSL configuration just to have it running out of the // box. Only for development purposes, never distribute an application // that relies on SSL with the default configuration set. You can // generate your own key and self-signed certificate: // // $ openssl req -x509 -newkey rsa:2048 -keyout server.key -nodes -days 365 -out server.crt QSslConfiguration sslConfiguration; QByteArray defaultKey = "-----BEGIN PRIVATE KEY-----\n" "MIIEvgIBADANBgkqhkiG9w0BAQEFAASCBKgwggSkAgEAAoIBAQDQdRrom1g/MsJh\n" "bfwVBZH+oxuGeIBO3jeNWs2bjpDmjtEtMz66LfFVrjuggt0UeNFb1Ve3tYIVq4Wj\n" "gmHYUOB44KCzVqJrd1mZdDKukdvoalJyh5f5/kqLdNGzrfjl5fmtK4jy76xM0oV4\n" "aZlj8eC4+odrS9HLHfBylDIeSXPWtThFw02IGiQALbtW8cqHSOXhucPAwiNFELVd\n" "jjFLa0buQSWq3WSZnroLwOXxfd2dtIoDIn319wTRFPAHWQDqlIuvefYvNzel65yY\n" "ZwoomIOrcxfN7IczLxkryD1uZpr4u2aWpHpz+mB7WXhPW82H6qT205e25iDbiZUQ\n" "+2UJWBHBAgMBAAECggEBAKF7Fe066ZGLcKio2q4uMnpfP+NbVYnC+qW1wbDPL9Bq\n" "sf+hwuXW0SzeW7JrrXc+YHATRHA7WxoOVOflCIbZoAoDeHl0kz1Mp0wIh3pT41aX\n" "hmbSQxiVtIlzZT8bdcQh8tgC8YO/xml8a4hrxTd3F+4zpNOpWEtQVgNsaaasn9+h\n" "/I/8uQ6oYkNISbnrs7u2fkFAw2/RbyZ6E2Dr9fMiDVUSa5ppFFHjfkgzbGA56Mtg\n" "0DdpxWMhICVMwlTI23zmjIAssyJG6xfCQfll9XbsiPAx9/uwAMIFPaUaWBzEUmhh\n" "L+/7hESQ7DGIfKxUqtiyvT53EuupxUxkcr0useZY5UECgYEA6wis5xcEo4eBk5o4\n" "IYcdZ93LrgwKtWj6e50sVs4NgCgsDWbH99IhNIxwQnCJ02O/aacbFV0d+jB9Jh+M\n" "NKTmqDxoe+EY2WJ+sR/YZ9VZwoHFwqubL1BzroX8FBN363tjicfFA+o3bSb4OXDC\n" "PIN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TIFICATE-----"; QSslKey sslKey(defaultKey, QSsl::Rsa); sslConfiguration.setPrivateKey(sslKey); QSslCertificate sslCertificate(defaultCertificate); sslConfiguration.setLocalCertificate(sslCertificate); sslConfiguration.setProtocol(QSsl::AnyProtocol); setSslConfiguration(sslConfiguration); }
  • 0 Votes
    1 Posts
    3k Views
    No one has replied
  • 0 Votes
    2 Posts
    1k Views
    M

    It's because Qt (or rather QSslSocket) closes the connection immediately after emitting the error() signal.

  • 0 Votes
    4 Posts
    2k Views
    SGaistS

    Hi and welcome to devnet,

    Currently just had a segmentation fault on OS X, will need to take a deeper look

  • 0 Votes
    2 Posts
    1k Views
    SGaistS

    Hi,

    Might be a silly question but is your OpenSSL library deployed with your application ? Or did you build it statically ?