tlslite.SharedKeyDB.SharedKeyDB

Package tlslite :: Module SharedKeyDB :: Class SharedKeyDB |
[show private | hide private]
[frames | no frames]

## Class SharedKeyDB

    BaseDB --+
             |
            SharedKeyDB

This class represent an in-memory or on-disk database of shared keys.

A SharedKeyDB can be passed to a server handshake function to authenticate a client based on one of the shared keys.

This class is thread-safe.

Method Summary
| ``__init__`(self, filename)` Create a new SharedKeyDB.
| ``__setitem__`(self, username, sharedKey)` Add a shared key to the database.
| `_checkItem(self, value, username, param)`
| `_getItem(self, username, valueStr)`
| `_setItem(self, username, value)`
Inherited from BaseDB
bool | ``__contains__`(self, username)` Check if the database contains the specified username.
| ``__delitem__`(self, username)`
| ``__getitem__`(self, username)`
| ``check`(self, username, param)`
| ``create`(self)` Create a new on-disk database.
list | ``keys`(self)` Return a list of usernames in the database.
| ``open`(self)` Open a pre-existing on-disk database.

Method Details

### __init__(self, filename=None) (Constructor) Create a new SharedKeyDB. Parameters: `filename` - Filename for an on-disk database, or None for an in-memory database. If the filename already exists, follow this with a call to open(). To create a new on-disk database, follow this with a call to create(). (type=str) Overrides: `tlslite.BaseDB.BaseDB.__init__`

### __setitem__(self, username, sharedKey) (Index assignment operator) Add a shared key to the database. Parameters: `username` - The username to associate the shared key with. Must be less than or equal to 16 characters in length, and must not already be in the database. (type=str) `sharedKey` - The shared key to add. Must be less than 48 characters in length. (type=str) Overrides: `tlslite.BaseDB.BaseDB.__setitem__`

Generated by Epydoc 2.0 on Mon Feb 21 21:56:55 2005 | http://epydoc.sf.net