Results 1 to 4 of 4

Thread: How to create a CRAM-MD5 password on QT

  1. #1
    Join Date
    May 2006
    Posts
    788
    Thanks
    49
    Thanked 48 Times in 46 Posts
    Qt products
    Qt4
    Platforms
    MacOS X Unix/X11 Windows

    Default How to create a CRAM-MD5 password on QT

    I have a smtp auth connection and is ready to read qt4...



    now i send
    1- ehlo localhost
    -------server
    250-remote.com
    250-STARTTLS
    250-PIPELINING
    250-8BITMIME
    250-SIZE 0
    250 AUTH LOGIN PLAIN CRAM-MD5
    -------server
    2- auth user@domaine.com
    3- 334 VXNlcm5hbWU6
    -------server
    235 authentication finished successfully
    -------server
    4- mail from: user@domaine.com
    Data .....
    and wait...
    -------server
    221 Bye
    -------server

    ..... How to create a CRAM-MD5 password on QT?

    Qt Code:
    1. Smtp::Smtp( const QString &from, const QString &to, const QString &subject, const QString &body )
    2. {
    3.  
    4. const QString smtphost = "ppk.go";
    5. const int Timeout = 5 * 1000;
    6. linesend = 0;
    7. qDebug() << "### Launch mail compose.... " << from << to << subject << body;
    8. qDebug() << "### Config server smtp connect to...... " << smtphost;
    9. smtpsocket = new QTcpSocket(this);
    10. connect( this, SIGNAL(ConnectorSuccess()), this ,SLOT(ReadLiner()));
    11. connect( this, SIGNAL(SendLine()), this ,SLOT(PutSendLine()));
    12. smtpsocket->connectToHost(smtphost,25);
    13. if (smtpsocket->waitForConnected(Timeout)) {
    14. qDebug() <<"### connected on " << smtphost;
    15. if (smtpsocket->waitForReadyRead(Timeout)) {
    16. qDebug() <<"### emit from waitForReadyRead connect go can read";
    17. emit ConnectorSuccess();
    18. }
    19. }
    20.  
    21. }
    22.  
    23. void Smtp::ReadLiner()
    24. {
    25. qDebug() << "### socketType = " << smtpsocket->socketType();
    26. qDebug() << "### ReadLiner is start by textstream ";
    27. t = new QTextStream( smtpsocket );
    28. int loops = 0;
    29. while (!t->atEnd()) {
    30. loops++;
    31. response = t->readLine();
    32. qDebug() << loops << " in line " << response;
    33. }
    34. if (response.size() > 0) {
    35. RemoteServerName = response;
    36. mailstatus = response.left(3);
    37. qDebug() << "###Status=" << mailstatus;
    38. if (mailstatus == "220") {
    39. linesend = 1;
    40. emit SendLine();
    41. }
    42. }
    43. }
    To copy to clipboard, switch view to plain text mode 

  2. #2
    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: How to create a CRAM-MD5 password on QT

    Use QSA or some other library.
    Last edited by jacek; 28th May 2006 at 00:04.

  3. #3
    Join Date
    Feb 2006
    Location
    Oslo, Norway
    Posts
    6,264
    Thanks
    36
    Thanked 1,519 Times in 1,389 Posts
    Qt products
    Qt4
    Platforms
    MacOS X Unix/X11 Windows Symbian S60 Maemo/MeeGo

    Default Re: How to create a CRAM-MD5 password on QT

    AFAIR there's some public domain implementation of MD5 in 3rd party sources of Qt... Check src/3rdparty..
    J-P Nurmi

  4. #4
    Join Date
    May 2006
    Posts
    788
    Thanks
    49
    Thanked 48 Times in 46 Posts
    Qt products
    Qt4
    Platforms
    MacOS X Unix/X11 Windows

    Default Re: How to create a CRAM-MD5 password on QT

    I tested encodeBase64 and mail is going/send .... Postfix server....
    auth ok ....

    But now i muss format a date so... ??

    message = "Date: Mon, 08 May 2006 17:57:52 +0200\n";

    on php i make this date quikly ... on qt Cutedatetime...

    class smtp auth have a look http://svn.sourceforge.net/viewcvs.c...cel-xslt/smtp/

    Qt Code:
    1. QString Smtp::encodeBase64( QString xml )
    2. {
    3. QByteArray text;
    4. text.append(xml);
    5. return text.toBase64();
    6. }
    To copy to clipboard, switch view to plain text mode 

Similar Threads

  1. Masking password
    By Lebowski in forum Qt Tools
    Replies: 3
    Last Post: 14th April 2006, 11:17
  2. Is it possible to create a QThread without inheriting ?
    By probine in forum Qt Programming
    Replies: 6
    Last Post: 23rd March 2006, 22:51
  3. How to create directories??
    By paranoid_android in forum Qt Programming
    Replies: 3
    Last Post: 9th March 2006, 16:28
  4. create file in another directory
    By raphaelf in forum Qt Programming
    Replies: 3
    Last Post: 16th February 2006, 10:04
  5. using Mysql: Ca't create TCP/IP socket
    By blackliteon in forum Qt Programming
    Replies: 6
    Last Post: 9th February 2006, 18:25

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.