<s> """<STR_LIT>""" <EOL> import os <EOL> from tlslite . utils import python_aes <EOL> from tlslite . utils import python_rc4 <EOL> from tlslite . utils import cryptomath <EOL> tripleDESPresent = False <EOL> if cryptomath . m2cryptoLoaded : <EOL> from tlslite . utils import openssl_aes <EOL> from tlslite . utils import openssl_rc4 <EOL> from tlslite . utils import openssl_tripledes <EOL> tripleDESPresent = True <EOL> if cryptomath . pycryptoLoaded : <EOL> from tlslite . utils import pycrypto_aes <EOL> from tlslite . utils import pycrypto_rc4 <EOL> from tlslite . utils import pycrypto_tripledes <EOL> tripleDESPresent = True <EOL> def createAES ( key , IV , implList = None ) : <EOL> """<STR_LIT>""" <EOL> if implList == None : <EOL> implList = [ "<STR_LIT>" , "<STR_LIT>" , "<STR_LIT>" ] <EOL> for impl in implList : <EOL> if impl == "<STR_LIT>" and cryptomath . m2cryptoLoaded : <EOL> return openssl_aes . new ( key , <NUM_LIT:2> , IV ) <EOL> elif impl == "<STR_LIT>" and cryptomath . pycryptoLoaded : <EOL> return pycrypto_aes . new ( key , <NUM_LIT:2> , IV ) <EOL> elif impl == "<STR_LIT>" : <EOL> return python_aes . new ( key , <NUM_LIT:2> , IV ) <EOL> raise NotImplementedError ( ) <EOL> def createRC4 ( key , IV , implList = None ) : <EOL> """<STR_LIT>""" <EOL> if implList == None : <EOL> implList = [ "<STR_LIT>" , "<STR_LIT>" , "<STR_LIT>" ] <EOL> if len ( IV ) != <NUM_LIT:0> : <EOL> raise AssertionError ( ) <EOL> for impl in implList : <EOL> if impl == "<STR_LIT>" and cryptomath . m2cryptoLoaded : <EOL> return openssl_rc4 . new ( key ) <EOL> elif impl == "<STR_LIT>" and cryptomath . pycryptoLoaded : <EOL> return pycrypto_rc4 . new ( key ) <EOL> elif impl == "<STR_LIT>" : <EOL> return python_rc4 . new ( key ) <EOL> raise NotImplementedError ( ) <EOL> def createTripleDES ( key , IV , implList = None ) : <EOL> """<STR_LIT>""" <EOL> if implList == None : <EOL> implList = [ "<STR_LIT>" , "<STR_LIT>" ] <EOL> for impl in implList : <EOL> if impl == "<STR_LIT>" and cryptomath . m2cryptoLoaded : <EOL> return openssl_tripledes . new ( key , <NUM_LIT:2> , IV ) <EOL> elif impl == "<STR_LIT>" and cryptomath . pycryptoLoaded : <EOL> return pycrypto_tripledes . new ( key , <NUM_LIT:2> , IV ) <EOL> raise NotImplementedError ( ) </s>
