我正在尝试使用 Charm Cryptography 库。我已经安装了该库,并且可以看到 Python/Lib/site-packages 中的彩蛋。当我使用命令行运行以下程序时,它确实如此,但是当我尝试将 Eclipse 与 PyDev 插件一起使用时,它给了我这个错误。我使用的是 Python 2.7、Windows 7。如果需要任何其他信息,请告诉我。
Traceback (most recent call last):
File "C:\Users\raunak\Documents\workspace1\ABETest\src\test\ABETest.py", line 6, in <module>
from charm.toolbox.pairinggroup import PairingGroup,GT
File "C:\Python27\Lib\site-packages\Charm_Crypto-0.42-py2.7-win32.egg\charm\toolbox\pairinggroup.py", line 2, in <module>
from charm.core.math.pairing import pairing,ZR,G1,G2,GT,init,pair,hashPair,H,random,serialize,deserialize,ismember,order
ImportError: DLL load failed: The specified module could not be found.
from charm.toolbox.pairinggroup import PairingGroup,GT
from charm.schemes.abenc.abenc_waters09 import CPabe09
group = PairingGroup('SS512')
cpabe = CPabe09(group)
msg = group.random(GT)
(master_secret_key, master_public_key) = cpabe.setup()
policy = '((ONE or THREE) and (TWO or FOUR))'
attr_list = ['THREE', 'ONE', 'TWO']
secret_key = cpabe.keygen(master_public_key, master_secret_key, attr_list)
cipher_text = cpabe.encrypt(master_public_key, msg, policy)
decrypted_msg = cpabe.decrypt(master_public_key, secret_key, cipher_text)
print decrypted_msg == msg
更新:
Python Path from IDE:
['C:\\Users\\raunak\\Documents\\workspace1\\ABETest\\src\\test',
'C:\\Users\\raunak\\Documents\\workspace1\\ABETest\\src',
'C:\\Python27\\Lib\\site-packages\\distribute-0.6.35-py2.7.egg',
'C:\\Python27\\Lib\\site-packages\\Charm_Crypto-0.42-py2.7-win32.egg',
'C:\\Python27\\DLLs',
'C:\\Python27\\lib',
'C:\\Python27\\lib\\plat-win',
'C:\\Python27\\lib\\lib-tk', 'C:\\Python27',
'C:\\Python27\\lib\\site-packages',
'C:\\eclipse\\plugins\\org.python.pydev_2.7.3.2013031601\\pysrc\\pydev_sitecustomize',
'C:\\Windows\\system32\\python27.zip',
'C:\\Python27\\lib\\plat-win']
Python From Command Line:
['C:\\',
'C:\\Python27\\lib\\site-packages\\distribute-0.6.35-py2.7.egg',
'C:\\%JYTHONPATH%',
'C:\\Windows\\system32\\python27.zip',
'C:\\Python27\\DLLs',
'C:\\Python27\\lib',
'C:\\Python27\\lib\\plat-win',
'C:\\Python27\\lib\\lib-tk',
'C:\\Python27',
'C:\\Python27\\lib\\site-packages',
'C:\\Python27\\lib\\site-packages\\Charm_Crypto-0.42-py2.7-win32.egg']