Package beepy :: Package profiles :: Module saslotpprofile :: Class OTPGenerator
[show private | hide private]
[frames | no frames]

Class OTPGenerator

OTPdbase --+
           |
          OTPGenerator


An OTPGenerator provides the methods required to generate One Time Passwords.
Method Summary
  __init__(self, dbasefile)
  authenticate(self, algo, username, bytestring)
authenticate() takes the username and passphrase hash it receives (presumably from a client) and checks it against the expected OTP in the dbase.
  convertBytesToHex(self, bytestring)
Convert a bytestring to a string of hex characters.
  convertBytesToLong(self, bytestring)
Converts an 8 byte bytestring to a long
  convertBytesToWords(self, bytestring)
Converts a bytestring to a string containing a worded encoding of the bytes.
  convertHexToBytes(self, hexstring)
This method converts a 16 character hex string to a bytestring.
  convertLongToBytes(self, hashlong)
Converts a long to an 8 byte bytestring
  convertWordsToBytes(self, wordstring)
Converts a series of words to the bytestring the words have encoded.
  createHash(self, username, algo, seed, passphrase, sequence)
Create a hash of a passphrase based on the sequence number and seed.
  createOTP(self, username, algo, seed, passphrase, sequence)
createOTP() should be used if you want to get all the relevent information using your own user interface and just use the hash generation code within this library.
  generateHash(self, algo, data)
Generate a hash of the data.
  getChallenge(self, username)
getChallenge() looks up the username in the OTP dbase and builds the appropriate OTP challenge string.
  promptAndGenerate(self)
A testing method used to create an OTP from values entered at the command line.
  validateAlgorithm(self, algo)
Check that the algorithm is supported.
  validatePassphrase(self, passphrase)
Check that a passphrase is a valid length.
  validateSeed(self, seed)
Check that a seed is a valid length and doesn't contain any invalid characters.
  validateSequence(self, seq)
Check that the sequence number is valid.
  validateUsername(self, username)
Check to make sure a username hasn't already been used.
    Inherited from OTPdbase
  retrieveDBEntry(self, username)
Retrieve a user entry from the database that corresponds to the supplied username.
  storeDBEntry(self, dbEntry)
storeDBEntry() stores a single OTPUserEntry in the database file set at initialisation.

Method Details

authenticate(self, algo, username, bytestring)

authenticate() takes the username and passphrase hash it receives (presumably from a client) and checks it against the expected OTP in the dbase. passhash is an 8 byte string

convertBytesToHex(self, bytestring)

Convert a bytestring to a string of hex characters.

Warning: This method only accepts 8 byte bytestrings

convertBytesToLong(self, bytestring)

Converts an 8 byte bytestring to a long
Returns:
long

convertBytesToWords(self, bytestring)

Converts a bytestring to a string containing a worded encoding of the bytes.
Returns:
string

convertHexToBytes(self, hexstring)

This method converts a 16 character hex string to a bytestring.
Returns:
bytestring

convertLongToBytes(self, hashlong)

Converts a long to an 8 byte bytestring
Returns:
bytestring

convertWordsToBytes(self, wordstring)

Converts a series of words to the bytestring the words have encoded.
Returns:
bytestring

createHash(self, username, algo, seed, passphrase, sequence)

Create a hash of a passphrase based on the sequence number and seed.

createOTP(self, username, algo, seed, passphrase, sequence)

createOTP() should be used if you want to get all the relevent information using your own user interface and just use the hash generation code within this library.

generateHash(self, algo, data)

Generate a hash of the data.

Warning: only md5 hashes are currently supported.

getChallenge(self, username)

getChallenge() looks up the username in the OTP dbase and builds the appropriate OTP challenge string.

promptAndGenerate(self)

A testing method used to create an OTP from values entered at the command line.

validateAlgorithm(self, algo)

Check that the algorithm is supported.
Raises:
ValueError - if algo is not supported

validatePassphrase(self, passphrase)

Check that a passphrase is a valid length.
Raises:
ValueError - if passphrase is invalid

validateSeed(self, seed)

Check that a seed is a valid length and doesn't contain any invalid characters.
Raises:
ValueError - is seed is invalid

validateSequence(self, seq)

Check that the sequence number is valid.

validateUsername(self, username)

Check to make sure a username hasn't already been used.

Generated by Epydoc 2.0 on Thu Sep 30 14:39:24 2004 http://epydoc.sf.net