Skip to content

Support multiple ABEnc adapters with varying schemes#254

Merged
jakinyele merged 1 commit intoJHUISI:devfrom
raghavkaul:patch-2
Sep 9, 2020
Merged

Support multiple ABEnc adapters with varying schemes#254
jakinyele merged 1 commit intoJHUISI:devfrom
raghavkaul:patch-2

Conversation

@raghavkaul
Copy link
Copy Markdown

When instantiating multiple HybridABEnc adapters with varying ABEnc schemes, the last ABEnc scheme overwrites the keygen/encrypt/decrypt functions for all other adapters.

Small test case:

>>> from charm.toolbox.pairinggroup import PairingGroup
>>> from charm.schemes.abenc.abenc_bsw07 import CPabe_BSW07
>>> from charm.schemes.abenc.abenc_waters09 import CPabe09
>>> from charm.adapters.abenc_adapt_hybrid import HybridABEnc
>>> group = PairingGroup("SS512")
>>> bsw07 = CPabe_BSW07(group)
>>> mpk, mk = bsw07.setup()
>>> waters09 = CPabe09(group)
>>> hyb_bsw07 = HybridABEnc(bsw07, group)
>>> hyb_bsw07.encrypt(mpk, b"foo", "A AND B")
{'c1': ... } # Correct result
>>> hyb_waters09 = HybridABEnc(waters09, group)
>>> hyb_bsw07.encrypt(mpk, b"foo", "A AND B")
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/usr/local/lib/python3.6/dist-packages/Charm_Crypto-0.50-py3.6-linux-x86_64.egg/charm/adapters/abenc_adapt_hybrid.py", line 38, in encrypt
    c1 = abenc.encrypt(pk, key, object)
  File "/usr/local/lib/python3.6/dist-packages/Charm_Crypto-0.50-py3.6-linux-x86_64.egg/charm/schemes/abenc/abenc_waters09.py", line 69, in encrypt
    C_tilde = (pk['e(gg)^alpha'] ** s) * M
KeyError: 'e(gg)^alpha'

When instantiating multiple HybridABEnc adapters with varying ABEnc schemes, the last ABEnc scheme overwrites the keygen/encrypt/decrypt functions for all other adapters.

Small test case:

	>>> from charm.toolbox.pairinggroup import PairingGroup
	>>> from charm.schemes.abenc.abenc_bsw07 import CPabe_BSW07
	>>> from charm.schemes.abenc.abenc_waters09 import CPabe09
	>>> from charm.adapters.abenc_adapt_hybrid import HybridABEnc
	
	>>> group = PairingGroup("SS512")
	>>> bsw07 = CPabe_BSW07(group)
	>>> mpk, mk = bsw07.setup()
	>>> waters09 = CPabe09(group)
	>>> hyb_bsw07 = HybridABEnc(bsw07, group)
	>>> hyb_bsw07.encrypt(mpk, b"foo", "A AND B")
		{'c1': ... } # Correct result
	>>> hyb_waters09 = HybridABEnc(waters09, group)
	>>> hyb_bsw07.encrypt(mpk, b"foo", "A AND B")
	Traceback (most recent call last):
	  File "<stdin>", line 1, in <module>
	  File "/usr/local/lib/python3.6/dist-packages/Charm_Crypto-0.50-py3.6-linux-x86_64.egg/charm/adapters/abenc_adapt_hybrid.py", line 38, in encrypt
	    c1 = abenc.encrypt(pk, key, object)
	  File "/usr/local/lib/python3.6/dist-packages/Charm_Crypto-0.50-py3.6-linux-x86_64.egg/charm/schemes/abenc/abenc_waters09.py", line 69, in encrypt
	    C_tilde = (pk['e(gg)^alpha'] ** s) * M
	KeyError: 'e(gg)^alpha'
@jakinyele jakinyele merged commit 2e23ae8 into JHUISI:dev Sep 9, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants