Results 1 to 9 of 9

Thread: Using TLS to secure an SMTP connection

  1. #1
    Join Date
    Jan 2006
    Posts
    26
    Thanked 1 Time in 1 Post
    Qt products
    Qt3 Qt4
    Platforms
    Unix/X11 Windows

    Default Using TLS to secure an SMTP connection

    I'm trying to use TLS to connect to a secure SMTP server, but to be perfectly honest, I don't know where to begin. I have the socket (QTcpSocket, as it were) running fine and everything, but I'm not sure how I would go about encrypting that socket or the transactions operated therein. Can anyone help me out?

  2. #2
    Join Date
    Jan 2006
    Location
    Germany
    Posts
    85
    Thanks
    1
    Thanked 2 Times in 2 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11

    Default Re: Using TLS to secure an SMTP connection

    Do you have any experience with crypto? What you are trying seems to be (is?) very difficult to do right (read: really secure).
    Search for a mail library which supports TLS and SSL. If you want to do the smtp yourself use OpenSSL or another encryption library.

  3. #3
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,359
    Thanks
    3
    Thanked 5,015 Times in 4,792 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android Maemo/MeeGo
    Wiki edits
    10

    Default Re: Using TLS to secure an SMTP connection

    In our links section there is a link (in "Libraries") to cryptographic support for Qt. AFAIR it uses Qt3 and I guess you use Qt4, but maybe you can use it anyway.

    An alternative is to implement a QIODevice which you should place on top of the socket device which will handle encryption/decryption. In Qt Quarterly there was an article how to do it (and it is better to do it this way -- QCA uses some other mechanism to achieve the same goal).

  4. #4
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    5,372
    Thanks
    28
    Thanked 976 Times in 912 Posts
    Qt products
    Qt3 Qt4
    Platforms
    Unix/X11 Windows

    Default Re: Using TLS to secure an SMTP connection

    Quote Originally Posted by wysota
    AFAIR it uses Qt3 and I guess you use Qt4, but maybe you can use it anyway.
    You can checkout the Qt4 version from KDE's subversion repository.

  5. #5
    Join Date
    Jan 2006
    Posts
    26
    Thanked 1 Time in 1 Post
    Qt products
    Qt3 Qt4
    Platforms
    Unix/X11 Windows

    Default Re: Using TLS to secure an SMTP connection

    Indeed, I found the QCA-2 beta1 files (via a Google search). I already knew about QCA, I just hadn't known about version 2, which is meant for Qt4. It comes with a socket example, so I should be able to figure my way out from there.

    I don't actually have any experience in coding encryption, though I know a little about how it works and such. This is mostly a program I'm writing for convenience, so I was just hoping I could put something together fairly quickly; fortunately, it seems like that will be possible.

    Thank you all for replying :-)

    EDIT: Also, concerning an SMTP library that supports TLS: I have searched. I just didn't find any at all.
    Last edited by Shadowfiend; 28th January 2006 at 17:49.

  6. #6
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,359
    Thanks
    3
    Thanked 5,015 Times in 4,792 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android Maemo/MeeGo
    Wiki edits
    10

    Default Re: Using TLS to secure an SMTP connection

    Quote Originally Posted by Shadowfiend
    EDIT: Also, concerning an SMTP library that supports TLS: I have searched. I just didn't find any at all.
    Because SMTP has almost nothing to do with TLS. TLS is a transport method whereas SMTP is an application protocol.

  7. #7
    Join Date
    Jan 2006
    Posts
    26
    Thanked 1 Time in 1 Post
    Qt products
    Qt3 Qt4
    Platforms
    Unix/X11 Windows

    Default Re: Using TLS to secure an SMTP connection

    I would argue that that is mostly incorrect. TLS may have almost nothing to do with SMTP, but vice versa is not true, as many SMTP servers encrypt their connections over TLS. The protocol and the transport method are unrelated as to their development, but not as to their usage. Thus, having TLS support in an SMTP library is a very convenient thing. Not required, but convenient.

  8. #8
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    5,372
    Thanks
    28
    Thanked 976 Times in 912 Posts
    Qt products
    Qt3 Qt4
    Platforms
    Unix/X11 Windows

    Default Re: Using TLS to secure an SMTP connection

    Have you seen this?

  9. #9
    Join Date
    Jan 2006
    Posts
    26
    Thanked 1 Time in 1 Post
    Qt products
    Qt3 Qt4
    Platforms
    Unix/X11 Windows

    Default Re: Using TLS to secure an SMTP connection

    I had not. I guess my search wasn't as far-reaching as I thought. Disappointing, too, since I did a search for SMTP or something of the sort on Sourceforge and this didn't show up, at least not in the first several pages.

    Thanks!

Similar Threads

  1. SQL connection closure problem.
    By cbarmpar in forum Qt Programming
    Replies: 1
    Last Post: 8th September 2008, 08:42
  2. Client/Server Error: BadIDChoice
    By 3nc31 in forum Qt Programming
    Replies: 5
    Last Post: 27th November 2007, 10:22

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Digia, Qt and their respective logos are trademarks of Digia Plc in Finland and/or other countries worldwide.