sagrawal87 / ABE

Attribute-based Encryption
MIT License
191 stars 69 forks source link

Pairing.Error: unsupported right operand types: int, bytes, str #2

Open RockyZhangHKU opened 6 years ago

RockyZhangHKU commented 6 years ago

Hi, I meet an error when I runpython main.py like this. My environment is Python 2.7.12 , Charm 0.42 and Ubuntu (16.04)

Traceback (most recent call last):
  File "main.py", line 42, in <module>
    main()
  File "main.py", line 29, in main
    ctxt = cpabe.encrypt(pk, msg, policy_str)
  File "/home/rocky/Desktop/ABE-master/ac17.py", line 203, in encrypt
    prod1 *= (hash_table[j][l][t] ** row[j])
pairing.Error: unsupported right operand types: int, bytes, str

Does author meet this error before? I am wondering whether it it caused by the Charm version?

emantas commented 6 years ago

@sagrawal87 Same error here , same configuration as Rocky before. Any solution so far?

sagrawal87 commented 6 years ago

Hi. I haven't seen this error before. May be try the newer version of Charm, Charm 0.43, which I used. It can be downloaded from here.

Let me know if the error doesn't go away.

emantas commented 6 years ago

@sagrawal87 tried it with Charm 0.43 and still the same error

RockyZhangHKU commented 6 years ago

@emantas @sagrawal87 Hi, everyone, I also tried Charm 0.43 on my Mac OS(High Sierra10.13, Python 2.7.11). After Installing GMP 5.x, PBC, OpenSSL, I download the Charm-Crypto-0.43_Python2.7.tar.gz (Python 2.7 Source) on my laptop, when executing "make", I meet this error:

Setup build/staging directories set -x set +x Building the Charm Framework /Users/rocky/anaconda/bin/python distribute_setup.py Downloading http://pypi.python.org/packages/source/d/distribute/distribute-0.6.42.tar.gz Traceback (most recent call last): File "distribute_setup.py", line 497, in <module> main(sys.argv[1:]) File "distribute_setup.py", line 492, in main tarball = download_setuptools() File "distribute_setup.py", line 193, in download_setuptools src = urlopen(url) File "/Users/rocky/anaconda/lib/python2.7/urllib2.py", line 154, in urlopen return opener.open(url, data, timeout) File "/Users/rocky/anaconda/lib/python2.7/urllib2.py", line 437, in open response = meth(req, response) File "/Users/rocky/anaconda/lib/python2.7/urllib2.py", line 550, in http_response 'http', request, response, code, msg, hdrs) File "/Users/rocky/anaconda/lib/python2.7/urllib2.py", line 475, in error return self._call_chain(*args) File "/Users/rocky/anaconda/lib/python2.7/urllib2.py", line 409, in _call_chain result = func(*args) File "/Users/rocky/anaconda/lib/python2.7/urllib2.py", line 558, in http_error_default raise HTTPError(req.get_full_url(), code, msg, hdrs, fp) urllib2.HTTPError: HTTP Error 403: SSL is required make: *** [all] Error 1 I am wondering whether it caused by my openssl installation, have you meet this error before?

RockyZhangHKU commented 6 years ago

@sagrawal87 Hi Shashank, can I ask you which is your Charm 0.43 version? Charm-Crypto-0.43.dmg (Mac OS X 10.6+ Installer) or Charm-Crypto-0.43_Python2.7.tar.gz (Python 2.7 Source)?Have you test your code under Charm-dev?

sagrawal87 commented 6 years ago

The DMG file is an easy way to install charm. Just download, extract, and follow the instructions in README-OSX.rtf. I think dependencies like PBC, OpenSSL, etc. are automatically taken care of.

RockyZhangHKU commented 6 years ago

Hi Shashank, Thanks for your response, well, I still failed in my Macbook, but then I have deployed it successfully in my Ubuntu 12.04 with Charm 0.42 and Python 3.2.3. The AC17 and BSW07 scheme has been tested correctly. 👍 But there is another issue about CGW15 and waters11 scheme. I will open a new topic to talk with you more.

stylishssai commented 5 years ago

**sai@sai-Lenovo-Invalid-entry-length-16-Fixed-up-to-11:~/Downloads/veera/code/ABE$ python main.py* Traceback (most recent call last): File "main.py", line 38, in main() File "main.py", line 25, in main ctxt = cpabe.encrypt(pk, msg, policy_str) File "/home/sai/Downloads/veera/code/ABE/ac17.py", line 186, in encrypt prod1 = (hash_table[j][l][t] ** row[j]) pairing.Error: unsupported right operand types: int, bytes, str @RockyZhangHKU please help me for getting this error...AC17 scheme
I am using Ubuntu 16.04 and python 2.7

samandeepdhindsa18 commented 5 years ago

HI @RockyZhangHKU , I am facing the same issue ,can you suggest me the solution?

File "main.py", line 31, in main ctxt = cpabe.encrypt(pk, msg, policy_str) File "/home/ubuntu/Desktop/CodeAccessControl/ABE-master/ac17.py", line 201, in encrypt prod1 *= (hash_table[j][l][t] row[j]) pairing.Error: unsupported right operand types: int, bytes, str**

samandeepdhindsa18 commented 5 years ago

HI @sagrawal87 ,

I am facing the same issue ,can you suggest me the solution?

File "main.py", line 31, in main ctxt = cpabe.encrypt(pk, msg, policy_str) File "/home/ubuntu/Desktop/CodeAccessControl/ABE-master/ac17.py", line 201, in encrypt prod1 *= (hash_table[j][l][t] ** row[j]) pairing.Error: unsupported right operand types: int, bytes, str

sagrawal87 commented 5 years ago

@samandeepdhindsa18 Could you say which version of Charm and Python are you using?

samandeepdhindsa18 commented 5 years ago

Hi Shashank,

I am using Python 2.7.16 and Charm-Crypto-0.42-Python2.7 Version.

Note: I am finding listed error while using ac17.py but not in bsw07.py. So now my code is in running state.

Thanks & Regards, Samandeep

On Fri, Aug 16, 2019 at 1:25 AM Shashank Agrawal notifications@github.com wrote:

@samandeepdhindsa18 https://github.com/samandeepdhindsa18 Could you say which version of Charm and Python are you using?

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/sagrawal87/ABE/issues/2?email_source=notifications&email_token=ALMKMUPN2WNNDZAPZKDDICDQEY25TA5CNFSM4ENNJJ6KYY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOD4NWFWI#issuecomment-521888473, or mute the thread https://github.com/notifications/unsubscribe-auth/ALMKMUNNCMTNAVUXDAHFOVTQEY25TANCNFSM4ENNJJ6A .

sagrawal87 commented 5 years ago

@samandeepdhindsa18 Try Charm 0.43 from here

canhtuan97 commented 4 years ago

How can I save the masterkey and the publickey at the server and when I reboot the server I can still use mk, pk? Charm-Crypto