CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 5 of 5

Hybrid View

  1. #1
    Join Date
    Apr 2015
    Posts
    5

    AUTH PLAIN base64 null character

    I am writing a c++ program that should send some mails using SMTP. I need to send the server the AUTH PLAIN request, so I need to code my "\0user@domain.com\0password" to base64, so that I can send the full request. When I pass the "\0user@domain.com\0password" to any program that decodes to base64 I got nothing, because I am starting my string with null character.

    Code for base64: http://www.adp-gmbh.ch/cpp/common/base64.html
    I am using Visual Studio 2010 on Windows 8.

    Could you help please.

  2. #2
    VictorN's Avatar
    VictorN is offline Super Moderator Power Poster
    Join Date
    Jan 2003
    Location
    Hanover Germany
    Posts
    20,398

    Re: AUTH PLAIN base64 null character

    Quote Originally Posted by tarekselmane View Post
    When I pass the "\0user@domain.com\0password" to any program that decodes to base64 I got nothing, because I am starting my string with null character.
    And why do you start your string with null character?
    Victor Nijegorodov

  3. #3
    Join Date
    Apr 2015
    Posts
    5

    Re: AUTH PLAIN base64 null character

    Good morning VictorN

    I am using SMTP protocol to send mails, and to send the server my authentication request I need to put in a buffer the following string
    "AUTH PLAIN AGFkbWluQGV4YW1wbGUuY29tAHBhc3N3b3Jk"
    AGFkbWluQGV4YW1wbGUuY29tAHBhc3N3b3Jk is the base64 coding for "\0admin@example.com\0password" without quotes.

    https://rtcamp.com/tutorials/mail/server/testing/smtp/

    http://www.fehcom.de/qmail/smtpauth.html

    I tried to use AUTH LOGIN, then send my username, ans password separately, but I could no get authenticated, that's why I refered to AUTH PLAIN, which needs one buffer to be sent, not 3

    Thank you in advance

  4. #4
    Join Date
    Apr 2000
    Location
    Belgium (Europe)
    Posts
    4,626

    Re: AUTH PLAIN base64 null character

    This is obviously wrong.
    SMTP is built entirely around 'readable characters' (typically even 7bit) with a couple allowed control characters like \n, \r, \t.
    \0 is not a valid character anywhere in the SMTP protocol.

  5. #5
    Join Date
    Apr 2015
    Posts
    5

    Re: AUTH PLAIN base64 null character

    Good afternoon OReubens
    I know that, but I don't want to use it in SMTP request, I need it in encoding base64 to get the ascii code to pass it to the buffer request

    wsprintf(buff_Sent, "AUTH PLAIN AGFkbWluQGV4YW1wbGUuY29tAHBhc3N3b3Jk\r\n");
    send(m_SocketSMTP , buff_Sent , (int)strlen(buff_Sent) , 0);

    https://rtcamp.com/tutorials/mail/server/testing/smtp/

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured