Coder Social home page Coder Social logo

abe's Introduction

Attribute-based Encryption

Attribute-based encryption enables fine-grained control of encrypted data [SW05]. In a ciphertext-policy ABE (CP-ABE) scheme [GPSW06], for instance, ciphertexts are attached to access policies and keys are associated with sets of attributes. A key is able to recover the message hidden in a ciphertext if and only if the set of attributes satisfy the access policy. To give an example, a policy P could say (Zipcode:90210 OR City:BeverlyHills) AND (AgeGroup:18-25) and an individual A could have a key for ({Zipcode:90210}, {AgeGroup:Over65}), in which case A would not be able to decrypt any message encrypted under P. A key policy (KP-ABE) scheme, on the other hand, is the dual of CP-ABE with ciphertexts attached to attribute sets and keys associated with access policies.

I have implemented several ABE schemes in Python using the Charm framework [AGMPRGP13]. Specifically, CP-ABE schemes from [BSW07, Section 4.2], [Waters11, Section 3], [CGW15, Appendix B.2 (full version)], and [AC17, Section 3] are implemented. All implementations are based on Type-III pairings; see AC17 for details.

Some of the schemes above are bounded universe, i.e. they support an a-priori bounded number of attributes. To initialize such schemes, an additional parameter uni_size needs to be specified. Some schemes are secure under the k-linear family of assumptions, so k must be set properly during initialization through the parameter assump_size.

Prerequisites

The schemes have been tested with Charm 0.43 and Python 2.7.10 on Mac OS X. Charm 0.43 can be installed from this page, or by running

pip install -r requirements.txt

Charm may not compile on Linux systems due to the incompatibility of OpenSSL versions 1.0 and 1.1. You can either install charm-crypto from the system package manager or downgrade OpenSSL to version 1.0.

Once you have Charm, just do

make && pip install . && python samples/main.py

to run the AC17 CP-ABE scheme. You can easily modify samples/main.py to try any scheme you wish.

References

  1. [SW05] Sahai, Amit, and Brent Waters. "Fuzzy identity-based encryption." In Eurocrypt, vol. 3494, pp. 457-473. 2005.
  2. [GPSW06] Goyal, Vipul, Omkant Pandey, Amit Sahai, and Brent Waters. "Attribute-based encryption for fine-grained access control of encrypted data." In Proceedings of the 13th ACM conference on Computer and communications security, pp. 89-98. ACM, 2006. Full version available on ePrint Archive, Report 2006/309.
  3. [BSW07] Bethencourt, John, Amit Sahai, and Brent Waters. "Ciphertext-policy attribute-based encryption." In Security and Privacy, 2007. SP'07. IEEE Symposium on, pp. 321-334. IEEE, 2007.
  4. [Waters11] Waters, Brent. "Ciphertext-policy attribute-based encryption: An expressive, efficient, and provably secure realization." In Public Key Cryptography, vol. 6571, pp. 53-70. 2011.
  5. [AGMPRGR13] Akinyele, Joseph A., Christina Garman, Ian Miers, Matthew W. Pagano, Michael Rushanan, Matthew Green, and Aviel D. Rubin. "Charm: a framework for rapidly prototyping cryptosystems." Journal of Cryptographic Engineering 3, no. 2 (2013): 111-128.
  6. [CGW15] Chen, Jie, Romain Gay, and Hoeteck Wee. "Improved Dual System ABE in Prime-Order Groups via Predicate Encodings." In Annual International Conference on the Theory and Applications of Cryptographic Techniques, pp. 595-624. Springer, Berlin, Heidelberg, 2015. Full version available on ePrint Archive, Report 2015/409.
  7. [AC17] Agrawal, Shashank, and Melissa Chase. "FAME: fast attribute-based message encryption." In Proceedings of the 2017 ACM SIGSAC Conference on Computer and Communications Security, pp. 665-682. 2017. Full version available on ePrint Archive, Report 2017/807.

abe's People

Contributors

alexkorpas avatar codymlewis avatar sagrawal87 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar

abe's Issues

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

Hi, I meet an error when I run python 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?

Type casting EC points from str to <class pairing.Element>

I was implementing a sample code and face the following problem.
P = P1 ** k gave error like left hand operand is not suitable, the issue is I have red the point P1 from a file. When I checked type(P1) it is showing str where as the points like P2=group.rand(G1) shows when used with type.

so how can I use the msg defined by my own,
msg = pairing_group.random(GT)
how can I convert bytes or str to pairing.Element?

NameError: name 'downcaseTokens' is not defined

Hi, I am trying to run your code on Ubuntu 18.04 with python3.6 and charm-crypto 0,50.

So far the compiling process is okay. All implementation of "make" and "make install" are all right. But the error "NameError: name 'downcaseTokens' is not defined" occurs when I run the code.

As far as I know, your code depends on python2.7 enviroment. Is there any conflicts between the code and python3.X? How should I fix this problem?

charm installation error

While running sudo make in Charm-crypto-0.43 directory getting error
sudo make
Setup build/staging directories
set -x
set +x
Building the Charm Framework
/usr/bin/python3 setup.py build
Extracting in /tmp/tmp82cjmzdb
Traceback (most recent call last):
File "/home/reetu/Charm-Crypto-0.43/distribute_setup.py", line 150, in use_setuptools
raise ImportError
ImportError

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File "setup.py", line 2, in
use_setuptools() #bootstrap installs Distribute if not installed
File "/home/reetu/Charm-Crypto-0.43/distribute_setup.py", line 152, in use_setuptools
return _do_download(version, download_base, to_dir, download_delay)
File "/home/reetu/Charm-Crypto-0.43/distribute_setup.py", line 132, in _do_download
_build_egg(egg, tarball, to_dir)
File "/home/reetu/Charm-Crypto-0.43/distribute_setup.py", line 105, in _build_egg
_extractall(tar)
File "/home/reetu/Charm-Crypto-0.43/distribute_setup.py", line 500, in _extractall
self.chown(tarinfo, dirpath)
TypeError: chown() missing 1 required positional argument: 'numeric_owner'
Makefile:27: recipe for target 'all' failed
make: *** [all] Error 1

Error: Could not find suitable distribution for Requirement.parse('pyparsing>=1.5.5')

Hi, I want to test the ac17.py scheme and need to install the Charm at first. While I meet this error when installing the charm cryptography library. My platform is ubuntu (16.04) and the python version is 2.7.12. The following error appears when executing make install.

No local packages or download links found for pyparsing>=1.5.5
error: Could not find suitable distribution for
Requirement.parse('pyparsing>=1.5.5')
Makefile:97: recipe for target 'install' failed

This is the output info when executing make install command.

removing 'build/bdist.linux-x86_64/egg' (and everything under it)
Processing Charm_Crypto-0.42-py2.7-linux-x86_64.egg
removing '/usr/local/lib/python2.7/dist-packages/Charm_Crypto-0.42-py2.7-linux-x86_64.egg' (and everything under it)
creating /usr/local/lib/python2.7/dist-packages/Charm_Crypto-0.42-py2.7-linux-x86_64.egg
Extracting Charm_Crypto-0.42-py2.7-linux-x86_64.egg to /usr/local/lib/python2.7/dist-packages
Charm-Crypto 0.42 is already the active version in easy-install.pth

Installed /usr/local/lib/python2.7/dist-packages/Charm_Crypto-0.42-py2.7-linux-x86_64.egg
Processing dependencies for Charm-Crypto==0.42
Searching for pyparsing>=1.5.5
Reading http://pypi.python.org/simple/pyparsing/
Couldn't find index page for 'pyparsing' (maybe misspelled?)
Scanning index of all packages (this may take a while)
Reading http://pypi.python.org/simple/
No local packages or download links found for pyparsing>=1.5.5
error: Could not find suitable distribution for Requirement.parse('pyparsing>=1.5.5')
Makefile:97: recipe for target 'install' failed

I have tried to fix this error and google some solution, someone said I should install pip and python setuptools and then install an old version of pyparsing (1.5.7). But this will appear another error also about pyparsing. I guess the key issue is pyparsing, and these are the files under the folder python2.7/dist-packages as following.

root@rocky-VirtualBox:/usr/local/lib/python2.7/dist-packages# ls
Charm_Crypto-0.42-py2.7-linux-x86_64.egg  pyparsing-1.5.7.dist-info
distribute-0.6.24-py2.7.egg               pyparsing.py
easy-install.pth                          pyparsing.pyc
easy_install.py                           setuptools
easy_install.pyc                          setuptools-0.6c11-py2.7.egg-info
pip                                       setuptools-38.4.0.dist-info
pip-9.0.1.dist-info                       setuptools.pth
pkg_resources

No result output

I ran through your code but there is no result output, how can I get the result for your paper?

BLS12-381 curve

Do you know how to adopt the BLS12-381 curve within charm-crypto (i.e. generating it with PBC)?

windows

How to install Charm_Crypto on Windows

msp.py 'unicode' object has no attribute Error

$ python main.py
Traceback (most recent call last):
  File "main.py", line 44, in <module>
    main()
  File "main.py", line 31, in main
    ctxt = cpabe.encrypt(pk, msg, policy_str)
  File "/Users/apple/Competion/Cryptology2018/ABE/ac17.py", line 152, in encrypt
    policy = self.util.createPolicy(policy_str)
  File "/Users/apple/Competion/Cryptology2018/ABE/msp.py", line 32, in createPolicy
    policy_obj = parser.parse(policy_string)
  File "/Library/Python/2.7/site-packages/charm/toolbox/policytree.py", line 83, in parse
    self.finalPol.parseString(string)
  File "/Library/Python/2.7/site-packages/pyparsing.py", line 1622, in parseString
    loc, tokens = self._parse( instring, 0 )
  File "/Library/Python/2.7/site-packages/pyparsing.py", line 1379, in _parseNoCache
    loc,tokens = self.parseImpl( instring, preloc, doActions )
  File "/Library/Python/2.7/site-packages/pyparsing.py", line 3717, in parseImpl
    return self.expr._parse( instring, loc, doActions, callPreParse=False )
  File "/Library/Python/2.7/site-packages/pyparsing.py", line 1379, in _parseNoCache
    loc,tokens = self.parseImpl( instring, preloc, doActions )
  File "/Library/Python/2.7/site-packages/pyparsing.py", line 3378, in parseImpl
    loc, resultlist = self.exprs[0]._parse( instring, loc, doActions, callPreParse=False )
  File "/Library/Python/2.7/site-packages/pyparsing.py", line 1379, in _parseNoCache
    loc,tokens = self.parseImpl( instring, preloc, doActions )
  File "/Library/Python/2.7/site-packages/pyparsing.py", line 3530, in parseImpl
    ret = e._parse( instring, loc, doActions )
  File "/Library/Python/2.7/site-packages/pyparsing.py", line 1379, in _parseNoCache
    loc,tokens = self.parseImpl( instring, preloc, doActions )
  File "/Library/Python/2.7/site-packages/pyparsing.py", line 3395, in parseImpl
    loc, exprtokens = e._parse( instring, loc, doActions )
  File "/Library/Python/2.7/site-packages/pyparsing.py", line 1379, in _parseNoCache
    loc,tokens = self.parseImpl( instring, preloc, doActions )
  File "/Library/Python/2.7/site-packages/pyparsing.py", line 3717, in parseImpl
    return self.expr._parse( instring, loc, doActions, callPreParse=False )
  File "/Library/Python/2.7/site-packages/pyparsing.py", line 1379, in _parseNoCache
    loc,tokens = self.parseImpl( instring, preloc, doActions )
  File "/Library/Python/2.7/site-packages/pyparsing.py", line 3378, in parseImpl
    loc, resultlist = self.exprs[0]._parse( instring, loc, doActions, callPreParse=False )
  File "/Library/Python/2.7/site-packages/pyparsing.py", line 1379, in _parseNoCache
    loc,tokens = self.parseImpl( instring, preloc, doActions )
  File "/Library/Python/2.7/site-packages/pyparsing.py", line 3530, in parseImpl
    ret = e._parse( instring, loc, doActions )
  File "/Library/Python/2.7/site-packages/pyparsing.py", line 1379, in _parseNoCache
    loc,tokens = self.parseImpl( instring, preloc, doActions )
  File "/Library/Python/2.7/site-packages/pyparsing.py", line 3395, in parseImpl
    loc, exprtokens = e._parse( instring, loc, doActions )
  File "/Library/Python/2.7/site-packages/pyparsing.py", line 1379, in _parseNoCache
    loc,tokens = self.parseImpl( instring, preloc, doActions )
  File "/Library/Python/2.7/site-packages/pyparsing.py", line 3717, in parseImpl
    return self.expr._parse( instring, loc, doActions, callPreParse=False )
  File "/Library/Python/2.7/site-packages/pyparsing.py", line 1379, in _parseNoCache
    loc,tokens = self.parseImpl( instring, preloc, doActions )
  File "/Library/Python/2.7/site-packages/pyparsing.py", line 3378, in parseImpl
    loc, resultlist = self.exprs[0]._parse( instring, loc, doActions, callPreParse=False )
  File "/Library/Python/2.7/site-packages/pyparsing.py", line 1379, in _parseNoCache
    loc,tokens = self.parseImpl( instring, preloc, doActions )
  File "/Library/Python/2.7/site-packages/pyparsing.py", line 3530, in parseImpl
    ret = e._parse( instring, loc, doActions )
  File "/Library/Python/2.7/site-packages/pyparsing.py", line 1379, in _parseNoCache
    loc,tokens = self.parseImpl( instring, preloc, doActions )
  File "/Library/Python/2.7/site-packages/pyparsing.py", line 3530, in parseImpl
    ret = e._parse( instring, loc, doActions )
  File "/Library/Python/2.7/site-packages/pyparsing.py", line 1405, in _parseNoCache
    tokens = fn( instring, tokensStart, retTokens )
  File "/Library/Python/2.7/site-packages/pyparsing.py", line 1049, in wrapper
    ret = func(*args[limit[0]:])
  File "/Library/Python/2.7/site-packages/charm/toolbox/policytree.py", line 15, in createAttribute
    return BinNode(toks[0]) # create
  File "/Library/Python/2.7/site-packages/charm/toolbox/node.py", line 26, in __init__
    elif(value >= OpType.OR and value < OpType.NONE):
  File "/Library/Python/2.7/site-packages/charm/toolbox/enum.py", line 29, in __le__
    return (self.__value <= other.__value)
AttributeError: 'unicode' object has no attribute '_EnumValue__value'

I follow your advice to install Charm in my MacOs, python is the system's default python 2.7.10 ,But meet this Error,Please Help......

encrypte file

If i want to encrypte some of my file,how can i modify the code?

NameError: name 'ZR' is not defined

In the pairinggroup.py, it has the code " from charm.core.math.pairing import pairing,pc_element,ZR,G1,G2,GT,init,pair,hashPair,H,random,serialize,deserialize,ismember,order ". However I can't find the ZR,G1...... How can I solve this problem? Have I miss some files?

Conditional Attributes and Policies

I want to create attributes and policies which are conditional in nature.

For instance:
Policy : AGE > 25
Attribute : AGE = 22

Decryption would not be possible in this case

How do I specify such attributes and policies?

ValueError: invalid literal for int() with base 10: 'FOUR'

Hi, Shashank, I meet this error when I test waters11 scheme as follows, do u meet this kind of error before?
root@ubuntu:/home/osborn/FAME# python3 main.py
setup Time: 495.1

keygen Time: 62.5

Traceback (most recent call last):
File "main.py", line 84, in <module>
main()
File "main.py", line 58, in main
ctxt = cpabe.encrypt(pk, msg, policy_str)
File "/home/osborn/FAME/waters11.py", line 110, in encrypt
c_attr = (pk['g1_a'] ** sum) / (pk['h'][int(attr_stripped)] ** r_attr)
ValueError: invalid literal for int() with base 10: 'FOUR'

The attribute list and policy which I set in main.py are as follows

attr_list = ['ONE', 'TWO', 'THREE', 'FOUR', 'FIVE', 'SIX', 'SEVEN', 'EIGHT', 'NINE', 'TEN']
policy_str = '(ONE and THREE and (TWO OR FOUR) and FIVE and SIX and SEVEN and EIGHT and NINE and TEN)'

So the error should be related to the ciphertext generation during encryption. But I don't understand what's the function of the attr_stripped = self.util.strip_index(attr) , I test the output of attr_stripped should be a string, but it will error when converting to int, can you give me some reminding about this?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.