Package pyxmpp :: Package sasl :: Module digest_md5
[show private | hide private]
[frames | no frames]

Module pyxmpp.sasl.digest_md5

DIGEST-MD5 authentication mechanism for PyXMPP SASL implementation.

Normative reference:
  - `RFC 2831 <http://www.ietf.org/rfc/rfc2831.txt>`__

Classes
DigestMD5ClientAuthenticator Provides PLAIN SASL authentication for a client.
DigestMD5ServerAuthenticator Provides DIGEST-MD5 SASL authentication for a server.

Function Summary
  _compute_response(urp_hash, nonce, cnonce, nonce_count, authzid, digest_uri)
Compute DIGEST-MD5 response value.
  _compute_response_auth(urp_hash, nonce, cnonce, nonce_count, authzid, digest_uri)
Compute DIGEST-MD5 rspauth value.
  _h_value(s)
H function of the DIGEST-MD5 algorithm (MD5 sum).
  _kd_value(k, s)
KD function of the DIGEST-MD5 algorithm.
  _make_urp_hash(username, realm, passwd)
Compute MD5 sum of username:realm:password.
  _quote(s)
Prepare a string for quoting for DIGEST-MD5 challenge or response.
  _unquote(s)
Unquote quoted value from DIGEST-MD5 challenge or response.

Variable Summary
str __revision__ = '$Id: digest_md5.py 559 2005-03-20 18:01:...
SRE_Pattern quote_re = (?!\\)\\(.)
SRE_Pattern _param_re = ^([^=]+)=(("(([^"\\]+)|(\\")|(\\\\))+")|([^"...

Imported modules:
logging, md5, re
Imported classes:
Challenge, ClientAuthenticator, Failure, Response, ServerAuthenticator, Success
Imported functions:
b2a_hex, from_utf8, to_utf8
Function Details

_compute_response(urp_hash, nonce, cnonce, nonce_count, authzid, digest_uri)

Compute DIGEST-MD5 response value.

:Parameters:
    - `urp_hash`: MD5 sum of username:realm:password.
    - `nonce`: nonce value from a server challenge.
    - `cnonce`: cnonce value from the client response.
    - `nonce_count`: nonce count value.
    - `authzid`: authorization id.
    - `digest_uri`: digest-uri value.
:Types:
    - `urp_hash`: `str`
    - `nonce`: `str`
    - `nonce_count`: `int`
    - `authzid`: `str`
    - `digest_uri`: `str`

:return: the computed response value.
:returntype: `str`

_compute_response_auth(urp_hash, nonce, cnonce, nonce_count, authzid, digest_uri)

Compute DIGEST-MD5 rspauth value.

:Parameters:
    - `urp_hash`: MD5 sum of username:realm:password.
    - `nonce`: nonce value from a server challenge.
    - `cnonce`: cnonce value from the client response.
    - `nonce_count`: nonce count value.
    - `authzid`: authorization id.
    - `digest_uri`: digest-uri value.
:Types:
    - `urp_hash`: `str`
    - `nonce`: `str`
    - `nonce_count`: `int`
    - `authzid`: `str`
    - `digest_uri`: `str`

:return: the computed rspauth value.
:returntype: `str`

_h_value(s)

H function of the DIGEST-MD5 algorithm (MD5 sum).

:Parameters:
    - `s`: a string.
:Types:
    - `s`: `str`

:return: MD5 sum of the string.
:returntype: `str`

_kd_value(k, s)

KD function of the DIGEST-MD5 algorithm.

:Parameters:
    - `k`: a string.
    - `s`: a string.
:Types:
    - `k`: `str`
    - `s`: `str`

:return: MD5 sum of the strings joined with ':'.
:returntype: `str`

_make_urp_hash(username, realm, passwd)

Compute MD5 sum of username:realm:password.

:Parameters:
    - `username`: a username.
    - `realm`: a realm.
    - `passwd`: a password.
:Types:
    - `username`: `str`
    - `realm`: `str`
    - `passwd`: `str`

:return: the MD5 sum of the parameters joined with ':'.
:returntype: `str`

_quote(s)

Prepare a string for quoting for DIGEST-MD5 challenge or response.

Don't add the quotes, only escape '"' and "\" with backslashes.

:Parameters:
    - `s`: a raw string.
:Types:
    - `s`: `str`

:return: `s` with '"' and "\" escaped using "\".
:returntype: `str`

_unquote(s)

Unquote quoted value from DIGEST-MD5 challenge or response.

If `s` doesn't start or doesn't end with '"' then return it unchanged,
remove the quotes and escape backslashes otherwise.

:Parameters:
    - `s`: a quoted string.
:Types:
    - `s`: `str`

:return: the unquoted string.
:returntype: `str`

Variable Details

__revision__

Type:
str
Value:
'$Id: digest_md5.py 559 2005-03-20 18:01:06Z jajcus $'                 

quote_re

Type:
SRE_Pattern
Value:
(?!\\)\\(.)                                                            

_param_re

Type:
SRE_Pattern
Value:
^([^=]+)=(("(([^"\\]+)|(\\")|(\\\\))+")|([^",]+))(,(.*))?$             

Generated by Epydoc 2.1 on Wed May 31 22:36:57 2006 http://epydoc.sf.net