[ANN] IMAP/SMTP authentication (cram-md5)
[1/3] from: rebol-list2::seznam::cz at: 19-Jun-2004 0:26
Hello rebolist,
I've just found (on Altme) that SMTP authentication is needed,
I don't use it but from some strange reason I did this function
some time ago which may be useful, so check it out.
--
Best regards,
rebOldes -----------------[ http://oldes.multimedia.cz/ ]
-- Binary/unsupported file stripped by Ecartis --
-- Type: text/x-rebol
-- File: cram-md5.r
[2/3] from: rebol-list2:seznam:cz at: 24-Jun-2004 23:56
Hello rebOldes,
Saturday, June 19, 2004, 12:26:26 AM, you wrote:
r> Hello rebolist,
r> I've just found (on Altme) that SMTP authentication is needed,
r> I don't use it but from some strange reason I did this function
r> some time ago which may be useful, so check it out.
r> --
r> Best regards,
r> rebOldes -----------------[ http://oldes.multimedia.cz/ ]
r> -- Binary/unsupported file stripped by Ecartis --
r> -- Type: text/x-rebol
r> -- File: cram-md5.r
Ech... so it's not possible to send Rebol script on ML:(
REBOL [
Title: "Cram-md5"
Date: 24-Dec-2003/13:30:21+1:00
Version: 0.1.0
Author: "oldes"
Usage: [
;Using values from RFC2195
probe cram-md5 "tim" "<[1896--697170952--postoffice--reston--mci--net]>" "tanstaaftanstaaf"
]
Purpose: {
This function returns CRAM-MD5 authentication string which may be used form IMAP or SMTP
Authentication.
Check RFC2195, RFC2554 and RFC2085 for more details.
}
Email: "oliva.david at seznam.cz"
]
cram-md5: func[
user_name
text
shared_key [string!] "string known only to the client and server"
/local ipad opad
][
either 64 < length? shared_key [
shared_key: checksum/method shared_key 'md5
][
shared_key: to binary! shared_key
]
insert/dup tail shared_key #{00} 64 - length? shared_key
ipad: make binary! 64 insert/dup ipad #{36} 64
opad: make binary! 64 insert/dup opad #{5C} 64
text: checksum/method rejoin [(shared_key XOR ipad) text] 'md5
text: checksum/method rejoin [(shared_key XOR opad) text] 'md5
parse/all lowercase form text [2 skip copy text to #"}"]
enbase/base rejoin [user_name " " text] 64
]
--
Best regards,
rebOldes -----------------[ http://oldes.multimedia.cz/ ]
[3/3] from: andreas:bolka:gmx at: 25-Jun-2004 14:46
Thursday, June 24, 2004, 11:56:12 PM, rebOldes wrote:
>> I've just found (on Altme) that SMTP authentication is needed, I
>> don't use it but from some strange reason I did this function some
>> time ago which may be useful, so check it out.
funnily enough I ran over the same problem about a year ago,
implemented my own HMAC/CRAM-MD5 stuff only to discover that it's
already built into REBOL. motivated by this discovery I wrote a
message <[1186563013--20030725192644--gmx--net]> to stop others from making
the same mistake ;)
amongst the ramblings I also suggested the following function:
cram-md5: func [ username challenge key ] [
reform [
username
lowercase
enbase/base
checksum/method/key challenge 'md5 key
16
]
]
--
Best regards,
Andreas