Package twisted :: Package python :: Module otp :: Class OTP

[show private | hide private]
[frames | no frames]

## Class OTP

    OTPAuthenticator --+
                       |
                      OTP

An automatic version of the OTP-Authenticator

Updates the sequence and the keeps last approved password on success On the next authentication, the stored password is hashed and checked up against the one given by the user. If they match, the sequencecounter is decreased and the circle is closed.

This object should be glued to each user

Note: It does NOT reset the sequence when the combinations left approach zero, This has to be done manuelly by instancing a new object

Method Summary
| ``__init__`(self, passwd, sequence, hash)` Initialize the OTP-Sequence, and discard the password
| ``authenticate`(self, phrase)` Test the phrase against the last challenge issued
| ``calculateParity`(self, otp)` Calculate the parity from a 64bit OTP (inherited from `OTPAuthenticator`)
| ``challenge`(self)` Return a challenge string
| `foldDigest(self, otp)` (inherited from `OTPAuthenticator`)
| ``foldDigest128`(self, otp128)` Fold a 128 bit digest to 64 bit (inherited from `OTPAuthenticator`)
| ``foldDigest160`(self, otp160)` Fold a 160 bit digest to 64 bit (inherited from `OTPAuthenticator`)
| ``generateOTP`(self, seed, passwd, sequence)` Return a 64 bit OTP based on inputs Run through makeReadable to get a 6 word pass-phrase (inherited from `OTPAuthenticator`)
| ``generateSeed`(self)` Return a 10 char random seed, with 6 lowercase chars and 4 digits (inherited from `OTPAuthenticator`)
| ``hashUpdate`(self, digest)` Run through the hash and fold to 64 bit (inherited from `OTPAuthenticator`)
| ``makeReadable`(self, otp)` Returns a 6 word pass-phrase from a 64bit OTP (inherited from `OTPAuthenticator`)
| ``parsePhrase`(self, phrase)` Decode the phrase, and return a 64bit OTP I will raise Unauthorized if the parity is wrong TODO: Add support for hex (MUST) and the '2nd scheme'(SHOULD) (inherited from `OTPAuthenticator`)

Class Variable Summary
`NoneType` | `lastotp`
`NoneType` | `seed`
`int` | `sequence`

Method Details

### __init__(self, passwd, sequence=1000, hash=<module 'md5' from '/usr/lib/python2.2/...)
(Constructor)

Initialize the OTP-Sequence, and discard the password

### authenticate(self, phrase)

Test the phrase against the last challenge issued

### challenge(self)

Return a challenge string

Class Variable Details

### lastotp

  Type:
    `NoneType`
  Value:

        None

### seed

  Type:
    `NoneType`
  Value:

        None

### sequence

  Type:
    `int`
  Value:

        0

Generated by Epydoc 1.1 on Thu May 8 13:16:49 2003 | http://epydoc.sf.net