Module digest_md5
source code
DIGEST-MD5 authentication mechanism for PyXMPP SASL implementation.
- Normative reference:
-
str
|
|
str
|
_quote(s)
Prepare a string for quoting for DIGEST-MD5 challenge or response. |
source code
|
|
str
|
|
str
|
|
str
|
|
str
|
|
str
|
|
|
quote_re = re.compile(r'(?<! \\) \\( .) ')
|
|
_param_re = re.compile(r'^(?P< var > [^ =] + ) =(?P< val > ( "( ( [ ^ "\\] + ) | ...
|
|
__package__ = ' pyxmpp.sasl '
|
Imports:
b2a_hex,
re,
logging,
hashlib,
ClientAuthenticator,
ServerAuthenticator,
Response,
Challenge,
Success,
Failure,
to_utf8,
from_utf8
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 (: str ) - : a quoted string.
- Returns:
str
- the unquoted string.
|
Prepare a string for quoting for DIGEST-MD5 challenge or response.
Don't add the quotes, only escape '"' and "" with backslashes.
- Parameters:
s (: str ) - : a raw string.
- Returns:
str
s with '"' and "" escaped using "".
|
H function of the DIGEST-MD5 algorithm (MD5 sum).
- Parameters:
- Returns:
str
- MD5 sum of the string.
|
KD function of the DIGEST-MD5 algorithm.
- Parameters:
k (: str ) - : a string.
s (: str ) - : a string.
- Returns:
str
- MD5 sum of the strings joined with ':'.
|
Compute MD5 sum of username:realm:password.
- Parameters:
username (: str ) - : a username.
realm (: str ) - : a realm.
passwd (: str ) - : a password.
- Returns:
str
- the MD5 sum of the parameters joined with ':'.
|
_compute_response(urp_hash,
nonce,
cnonce,
nonce_count,
authzid,
digest_uri)
| source code
|
Compute DIGEST-MD5 response value.
- Parameters:
urp_hash (: str ) - : MD5 sum of username:realm:password.
nonce (: str ) - : nonce value from a server challenge.
cnonce - : cnonce value from the client response.
nonce_count (: int ) - : nonce count value.
authzid (: str ) - : authorization id.
digest_uri (: str ) - : digest-uri value.
- Returns:
str
- the computed response value.
|
_compute_response_auth(urp_hash,
nonce,
cnonce,
nonce_count,
authzid,
digest_uri)
| source code
|
Compute DIGEST-MD5 rspauth value.
- Parameters:
urp_hash (: str ) - : MD5 sum of username:realm:password.
nonce (: str ) - : nonce value from a server challenge.
cnonce - : cnonce value from the client response.
nonce_count (: int ) - : nonce count value.
authzid (: str ) - : authorization id.
digest_uri (: str ) - : digest-uri value.
- Returns:
str
- the computed rspauth value.
|
_param_re
- Value:
re.compile(r'^(?P< var > [^ =] + ) =(?P< val > ( "( ( [ ^ "\\] + ) | ( \\") | ( \\\\) ) + ") | ( [ ^
",] + ) ) ( \s* ,\s* (?P< rest > .* ) ) ? $')
|
|