LinuxQuestions.org
Welcome to the most active Linux Forum on the web.
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices



Reply
 
Search this Thread
Old 07-23-2007, 06:07 PM   #1
nathacof
Member
 
Registered: Aug 2004
Location: Bear, DE, USA
Distribution: Slackware 11, CentOS 5.2, Ubuntu
Posts: 124

Rep: Reputation: 17
Php: Smtp-auth Cram-md5


For no other reason than I want to learn, I am writing my own mail class that will enable me to send emails regardless of the existence of a MTA on the web server.

Everything is working beautifully except my authentication mechanism:

PHP Code:
  function cram_md5($in){
    if(!isset(
$this->username) || !isset($this->password)) return FALSE;
    
$in explode(' '$in);
    if(
$in[0] == '334'){
      
$ticket base64_decode($in[1]);
      
$password hash_hmac('MD5'$this->password$ticket);
      return 
base64_encode($this->username." $password");
    }
  } 
This function accepts the return value from the server after issuing the AUTH CRAM-MD5 command.

Any help would be greatly appreciated.
 
Old 02-19-2011, 02:04 PM   #2
adrenalinedj
LQ Newbie
 
Registered: Feb 2011
Posts: 1

Rep: Reputation: 0
After 4 years, i don't know if you already need an answer but at least for those like me that needs the answer, here's the answer of your problem:

When you use CRAM-MD5 for authentication, it's the "ticket" given by server that must be "crypted" with the password.

So your call of "hash_hmac" is incorrect...

Here's the good call :
Code:
$password=hash_hmac('MD5', $ticket, $password);
I tested it and it works for me...

Last edited by adrenalinedj; 02-19-2011 at 02:06 PM.
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
SMTP "open relay" and SMTP AUTH aikempshall Linux - Security 3 10-11-2006 09:19 AM
Kmail error "Unable to Authenticate via. CRAM-MD5" Spreegem Debian 2 08-04-2005 01:50 AM
Postfix cram-md5 authentication to earthlink relay spiritwing Linux - Software 2 07-13-2005 10:19 PM
What's going on with this SMTP AUTH. exper Linux - Software 0 12-25-2004 03:58 AM
Cram-MD5 encryption pembo13 Linux - Security 5 04-30-2004 04:05 PM


All times are GMT -5. The time now is 01:40 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration