1DigestMD5(3) User Contributed Perl Documentation DigestMD5(3)
2
3
4
6 Authen::DigestMD5 - SASL DIGEST-MD5 authentication (RFC2831)
7
9 use Authen::DigestMD5;
10
11 use OnLDAP;
12 $ld=OnLDAP::Client->new($host);
13 ($rc, $id)=$ld->sasl_bind(undef, 'DIGEST-MD5');
14 ($rc, $msg)=$ld->result($id);
15 ($rc, $req)=$ld->parse_sasl_bind_result($msg);
16
17 print "IN: |$req|\n";
18 my $request=Authen::DigestMD5::Request->new($req);
19 my $response=Authen::DigestMD5::Response->new;
20 $response->got_request($request);
21 $response->set(username => $user,
22 realm => $realm,
23 'digest-uri' => "ldap/$host");
24 $response->add_digest(password=>$passwd);
25 my $res=$response->output;
26 print "OUT: |$res|\n";
27
28 ($rc, $id)=$ld->sasl_bind(undef, 'DIGEST-MD5', $res);
29 ($rc, $msg)=$ld->result($id);
30 ($rc, $req)=$ld->parse_sasl_bind_result($msg);
31
32 $request->input($req);
33 print $request->auth_ok ? "AUTH OK\n" : "AUTH FAILED\n"
34
36 This module supports DIGEST-MD5 SASL authentication as defined on
37 RFC-2831.
38
40 This module implements three classes:
41
42 Authen::DigestMD5::Packet
43 base class implementing common methods to process SASL DIGEST-MD5
44 strings or objects:
45
46 Authen::DigestMD5::Packet->new(%props)
47 Authen::DigestMD5::Packet->new($input, %props)
48 create a new object with the properties in %props. If $input is
49 passed it is parsed and the values obtained from it added to
50 the object.
51
52 $pkt->input($input)
53 parses the properties on the string $input and adds them to the
54 object.
55
56 $pkt->output()
57 packs all the properties on the object as a string suitable for
58 sending to a SASL DIGEST-MD5 server or client.
59
60 $pkg->set($k1=>$v1, $k2=>$v2, ...)
61 $pkg->set(%props)
62 set object properties.
63
64 ($v1, $v2, ...)=$pkg->get($k1, $k2, ...)
65 gets object properties.
66
67 $pkg->reset()
68 clears public object properties. Some internal properties like
69 nc counters are retained.
70
71 Authen::DigestMD5::Request
72 class to represent SASL DIGEST-MD5 requests as obtained from a
73 server.
74
75 $req->auth_ok()
76 returns a true value if the request object contains a valid
77 authentication token.
78
79 Authen::DigestMD5::Response
80 class to represent and generate SASL DIGEST-MD5 responses suitables
81 for sending to a server.
82
83 $res->got_request($req)
84 adds certain properties to the response $res object generated
85 from the request $req ones.
86
87 $res->add_digest(password => $password)
88 adds the "response" property containing the MD5 digest to the
89 response object.
90
92 Be sure to look at Authen::SASL because it is very likely that it is
93 what you are looking for ("Authen::DigestMD5" is only suitable when you
94 need a finer control over the authentication procedure).
95
96 SASL DIGEST-MD5 RFC <http://www.ietf.org/rfc/rfc2831.txt>.
97
99 Salvador Fandiño, <sfandino@yahoo.com>
100
102 Copyright 2003 by Salvador Fandiño.
103
104 Portions of this module have been copied from the Authen::SASL package
105 by Graham Barr.
106
107 This library is free software; you can redistribute it and/or modify it
108 under the same terms as Perl itself.
109
111 Hey! The above document had some coding errors, which are explained
112 below:
113
114 Around line 317:
115 Non-ASCII character seen before =encoding in 'Fandiño,'. Assuming
116 UTF-8
117
118
119
120perl v5.36.0 2023-01-20 DigestMD5(3)