python pycrypto: module' object has no attribute 'importKey' -


i'm working pycrypto , want import public key,but can not work , raise error: 'module' object has no attribute 'importkey''
use pycrypto in other script,it works well,so can not understand why can not work.
code can't work following:

    crypto.publickey import rsa     .............     .............     def task_name(task):         username = task['user']         taskintid = task['taskintid']         data = '%s,%s' % (str(username), str(taskintid))         user_id = task.get('op_user_id', '')         db = get_db()          ssh_key = db.ssh_key.find_one({'user_id': user_id})         if ssh_key:             try:                 public_key = rsa.importkey(ssh_key.get('ssh_key', ''))                 data = public_key.encrypt(data, 32)[0].encode('hex')             except exception, e:                 print e      return "task-%s-%s" % (data, task['repeat_num']) 

also, python version 2.6.5
=======================================
sorry,i forgot it, pycrypto version 2.0.1
because have installed many packages,so can not upgrage pycrypto version

support exporting , importing rsa keys implemented in version 2.2 listed in changelog unless can upgrade out of luck.


Comments

Popular posts from this blog

c++ - No viable overloaded operator for references a map -

java - Custom OutputStreamAppender not run: LOGBACK: No context given for <MYAPPENDER> -

java - Cannot secure connection using TLS -