# ``twisted`.`words`.`protocols`.`jabber`.`sasl_mechanisms`.`DigestMD5``

class documentation

`class DigestMD5: (source)`

Implements interfaces: `twisted.words.protocols.jabber.sasl_mechanisms.ISASLMechanism`

View In Hierarchy

Implements the DIGEST-MD5 SASL authentication mechanism.

The DIGEST-MD5 SASL authentication mechanism is defined in RFC 2831.

Method | `__init__` |
Method | `getInitialResponse` | Get the initial client response, if defined for this mechanism.
Method | `getResponse` | Get the response to a server challenge.
Class Variable | `name` | Common name for the SASL Mechanism.
Instance Variable | `defaultRealm` | Undocumented
Instance Variable | `digest_uri` | Undocumented
Instance Variable | `password` | Undocumented
Instance Variable | `username` | Undocumented
Method | `_calculateResponse` | Calculates response with given encoded parameters.
Method | `_gen_nonce` | Undocumented
Method | `_genResponse` | Generate response-value.
Method | `_parse` | Parses the server challenge.
Method | `_unparse` | Create message string from directives.

def __init__(self, serv_type, host, serv_name, username, password): (source)

Parameters
serv_type:`unicode` | An indication of what kind of server authentication is being attempted against. For example, `u"xmpp"`.
host:`unicode` | The authentication hostname. Also known as the realm. This is used as a scope to help select the right credentials.
serv_name:`unicode` | An additional identifier for the server.
username:`unicode` | The authentication username to use to respond to a challenge.
password:`unicode` | The authentication password to use to respond to a challenge.

def getInitialResponse(self): (source)
from `twisted.words.protocols.jabber.sasl_mechanisms.ISASLMechanism`
Get the initial client response, if defined for this mechanism.

Returns
`str`. | initial client response string.

def getResponse(self, challenge): (source)
from `twisted.words.protocols.jabber.sasl_mechanisms.ISASLMechanism`
Get the response to a server challenge.

Parameters
challenge:`str`. | server challenge.
Returns
`str`. | client response.

name: `str` = (source)
from `twisted.words.protocols.jabber.sasl_mechanisms.ISASLMechanism`
Common name for the SASL Mechanism.
defaultRealm = (source)

Undocumented

digest_uri = (source)

Undocumented

password = (source)

Undocumented

username = (source)

Undocumented

def _calculateResponse(self, cnonce, nc, nonce, username, password, realm, uri): (source)
Calculates response with given encoded parameters.

Returns
`bytes` | The response field of a response to a Digest-MD5 challenge of the given parameters.

def _gen_nonce(self): (source)

Undocumented

def _genResponse(self, charset, realm, nonce): (source)

Generate response-value.

Creates a response to a challenge according to section 2.1.2.1 of RFC 2831 using the `charset`, `realm` and `nonce` directives from the challenge.

def _parse(self, challenge): (source)

Parses the server challenge.

Splits the challenge into a dictionary of directives with values.

Returns
`dict` of `str` to `str`. | challenge directives and their values.

def _unparse(self, directives): (source)
Create message string from directives.

Parameters
directives:`dict` of `str` to `str` | dictionary of directives (names to their values). For certain directives, extra quotes are added, as needed.
Returns
`str`. | message string.