<s> """<STR_LIT>""" <EOL> from . utils . cryptomath import * <EOL> from . utils . compat import * <EOL> from . mathtls import * <EOL> from . Session import Session <EOL> from . BaseDB import BaseDB <EOL> class SharedKeyDB ( BaseDB ) : <EOL> """<STR_LIT>""" <EOL> def __init__ ( self , filename = None ) : <EOL> """<STR_LIT>""" <EOL> BaseDB . __init__ ( self , filename , "<STR_LIT>" ) <EOL> def _getItem ( self , username , valueStr ) : <EOL> session = Session ( ) <EOL> session . _createSharedKey ( username , valueStr ) <EOL> return session <EOL> def __setitem__ ( self , username , sharedKey ) : <EOL> """<STR_LIT>""" <EOL> BaseDB . __setitem__ ( self , username , sharedKey ) <EOL> def _setItem ( self , username , value ) : <EOL> if len ( username ) > <NUM_LIT:16> : <EOL> raise ValueError ( "<STR_LIT>" ) <EOL> if len ( value ) >= <NUM_LIT> : <EOL> raise ValueError ( "<STR_LIT>" ) <EOL> return value <EOL> def _checkItem ( self , value , username , param ) : <EOL> newSession = self . _getItem ( username , param ) <EOL> return value . masterSecret == newSession . masterSecret </s>
