I've installed charm: https://github.com/JHUISI/charm/tree/dev
to Ubuntu server (64), compiles fine.
I'd like to try this example: https://jhuisi.github.io/charm/charm/schemes/abenc/abenc_bsw07.html
example.py:
from charm.toolbox.pairinggroup import PairingGroup,ZR,G1,G2,GT,pair
group = PairingGroup('SS512')
cpabe = CPabe_BSW07(group)
msg = group.random(GT)
attributes = ['ONE', 'TWO', 'THREE']
access_policy = '((four or three) and (three or one))'
(master_public_key, master_key) = cpabe.setup()
secret_key = cpabe.keygen(master_public_key, master_key, attributes)
cipher_text = cpabe.encrypt(master_public_key, msg, access_policy)
decrypted_msg = cpabe.decrypt(master_public_key, secret_key, cipher_text)
msg == decrypted_msg
The result is:
$ python3 example.py
Traceback (most recent call last):
File "PATH/charm/example.py", line 2, in <module>
group = PairingGroup('SS512')
File "PATH/charm/charm/toolbox/pairinggroup.py", line 19, in __init__
self.Pairing = pairing(string=pairID)
pairing.Error: invalid arguments
Some other try:
$ python3
Python 3.10.6 (main, Nov 2 2022, 18:53:38) [GCC 11.3.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> p = PairingGroup('SS512')
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
NameError: name 'PairingGroup' is not defined
>>> from charm.toolbox.pairinggroup import PairingGroup,ZR,G1,G2,GT,pair
>>> p = PairingGroup('SS512')
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "PATH/charm/charm/toolbox/pairinggroup.py", line 19, in __init__
self.Pairing = pairing(string=pairID)
pairing.Error: invalid arguments
>>> p = PairingGroup(SS512)
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
NameError: name 'SS512' is not defined
>>> p = PairingGroup(512)
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "PATH/charm/charm/toolbox/pairinggroup.py", line 25, in __init__
self.Pairing = pairing(param_id)
pairing.Error: invalid arguments
I'd appreciate your help. Thanks!