Giter Club home page Giter Club logo

charm's People

Contributors

ahmedmbakr avatar artjomb avatar bsloane1650 avatar christinalgarman avatar cygnusv avatar davidstritzl avatar dennisschroer avatar doughgle avatar edvtaz avatar friedrichsenm avatar imichaelmiers avatar jakinyele avatar jthure avatar lariffle avatar leafac avatar lenerd avatar lferr avatar locksmithone avatar lovesh avatar lrusso96 avatar matthewdgreen avatar matthewpagano avatar micharu123 avatar nikosft avatar nobody4t avatar sagrawal87 avatar terry-fee avatar timothymctim avatar tusharjois avatar zfwise 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  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

charm's Issues

Pairing groups fails to properly warn when performing operations on two different curves

This should be an MNT224 curve, we passed it an SS512
This should have failed cleanly, instead it fails with:

File "schemes/abenc/abenc_lsw08.py", line 33, in abenc_lsw08.KPabe
Failed example:
ciphertext = kpabe.encrypt(private_key, msg, attributes)
Exception raised:
Traceback (most recent call last):
File "/usr/lib/python3.2/doctest.py", line 1288, in __run
compileflags, 1), test.globs)
File "<doctest abenc_lsw08.KPabe[7]>", line 1, in
ciphertext = kpabe.encrypt(private_key, msg, attributes)
File "schemes/abenc/abenc_lsw08.py", line 111, in encrypt
return {'E1':(pk['e(gg)_alpha'] ** s) * M, 'E2':pk['g_G2'] ** s, 'E3':E3, 'attributes':attr_list }
KeyError: 'e(gg)_alpha'

"""
>>> from schemes.example_values import pairing_SS512_val as msg
>>> groupObj = PairingGroup('MNT224')
>>> kpabe = KPabe(groupObj)
>>> (public_key, master_key) = kpabe.setup()
>>> policy = '(ONE or THREE) and (THREE or TWO)'
>>> attributes = [ 'ONE', 'TWO', 'THREE', 'FOUR' ]
>>> private_key = kpabe.keygen(public_key, master_key, policy)

For conveniece, we are using a pre-defined message
>>> ciphertext = kpabe.encrypt(private_key, msg, attributes)

>>> kpabe.decrypt(ciphertext, mykey)
[8498626471746535541889196006969623245883442038940767658411896849230802260262151353691177896167637279292812138807029583456775233580306113979341887791855557, 6966939460945789223279096602928312619651295009575045207502056308294974480025386597816838423778648241850303711370830167285562786901756561121522858944449876] 
"""

Pyparsing and delimiting characters

Pyparsing crashes when the policy string contains attributes that have delimiting characters.
For example, the policy string (JHU_Professor AND JHMI_Staff) will cause pyparsing to crash.

Allowing delimiting characters in the policy string will be important in the muti authority setting of Attribute Based Encryption since each attribute must be unique. ie. it is important to distinguish what JHU calls "staff" and what JHMI calls "staff".

Core fault in modular division

>>> from charm.core.math.integer import integer
>>> x = integer(3,101)
>>> x ** (-1)
34 mod 101
>>> 1/x
zsh: segmentation fault (core dumped)  python3

Expected result: same as x ** (-1)

add documentation for group parameters

Right now, there is a hole in our documentation in terms of how to initialize schemes with group parameters (especially for pairings). So, we need to be explicit on all the different ways users can generate group parameters from type a (SS curves) to type d (MNT curves).

Add SymEnc base class to Charm

This is a base class wrapper for Symmetric encryption schemes. It's analogous to PKEnc. I would also like to create a subclass that implements a bunch of ciphers/modes of operation (basically you configure it with AES-GCM mode and then use it like a PKEnc).

build error on osx lion

/Library/Frameworks/Python.framework/Versions/3.2/include/python3.2m/Python.h:25:10:
fatal error: 'stdio.h' file not found

Apparentlly a known issue the latest version of XCode with python. Not related to our project, but it may be something we need to have a work around for

Solution for encrypting streams

Right now Charm only encrypts strings or bytes objects -- buffers in memory. However, for things like symmetric encryption of large files we will need the ability to process streams of data. We should think about how to handle these.

configure.sh $cpu

Lines 521-526... I added armv4b so cross compiling would not fail during the compiler test as -m64 is not supported, and by default configure checks the arch of the compilation machine. Not an eloquent solution.

if cross compiling, cannot launch a program, so make a static guess

case "$cpu" in
armv4b|hppa|m68k|mips|mips64|ppc|ppc64|s390|s390x|sparc|sparc64)
bigendian=yes
;;
esac

Create separate dir for adapters

Adapters by definition modify existing schemes and should be treated and tested in a different way. Therefore, remove all the adapters from schemes directory into their own dir.

fix needing --python=

Really the system should try to build and install for pythong 2* and 3 if possible and fall back to whichover one is present and warn on the other

Charm integers mix badly with Python integers

The integer routines in charm.core.math.integer give wrong results when combined with Python integers. I would expect y and z to have the same value as w, but z loses the modulus, whereas y actually swaps the operands to mod:

ubuntu% python3
Python 3.2.3 (default, Oct 19 2012, 20:13:42) 
[GCC 4.6.3] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import charm.core.math.integer as chint
>>> x = chint.integer(12345678)
>>> x
12345678
>>> y = 100 % x
>>> y
78 mod 100
>>> z = chint.integer(100,x)
>>> z
100
>>> w = chint.integer(100,int(x))
>>> w
100 mod 12345678

There are a few other bugs I have run into; might it make more sense to use the gmpy/gmpy2 libraries (http://code.google.com/p/gmpy/) instead in Charm?

(Note: I haven't used them myself but they seem a bit cleaner than Charm's version, if only by virtue of having documentation.)

Install on Ubuntu

The correct python3 path on ubuntu is
/usr/local/lib/python3.1/dist-packages

However, none of the standard system calls return this directory directly.

distutils.sysconfig.get_python_lib(0, 0, '/usr/local')
'/usr/local/lib/python3/dist-packages'
distutils.sysconfig.get_python_lib(0, 1, '/usr/local')
'/usr/local/lib/python3.1'
distutils.sysconfig.get_python_lib(1, 0, '/usr/local')
'/usr/local/lib/python3/dist-packages'
distutils.sysconfig.get_python_lib(1, 1, '/usr/local')
'/usr/local/lib/python3.1'

Source build/install

When doing a source build setup.py provides an easy-install.pth (path file) that points to charm crypto and distribute. This is fine, but on an actual dev box... this might already be in use and we aren't in the business of overwriting/appending that file. My solution in the windows installer is to add a charm.pth file with the line: ./charm-crypto-{version}-py{version}-win32.egg.

fix key deriviation for authenticated encryption

Right now authenticated encryption is done via a mac that is keyed with sha1(enc_key||"salt"). This is safe in the random oracle model, it is not in the standard model.

We should use a better extractor

make crypto functions operate on bytes

Modify all crypto functions and test examples to operate purely on bytes and leave string conversion up to either the dev or another tool we provide.

bus error in toobox tests on osx

Repos constantly. No clue whats wrong
On mike's system desktop :

minnie:charm ian$ make test
/opt/local/bin/python3.2 -m unittest discover -p "*_test.py" schemes/test/

.........................................................

Ran 57 tests in 16.241s

OK
find . -name '_.pyc' -delete
/opt/local/bin/python3.2 -m unittest discover -p "__test.py" charm-framework/test/toolbox/
make: *** [test-charm] Bus error: 10

remove param dir

Need to collapse param files for pbc pairing module into a python file with easy to remember identifiers e.g., MNT### or SS###, etc

Test pass needs to test install

There should be a way to run tests against the installed code as well. This should not be the default , but it is necessary to test certain things

remove static iv

iv  = '6543210987654321' # static IV (for testing)    
PRP_method = selectPRP(self.alg, (key, mode, iv))

Should not be used. IV should be random

remove config.mk from MANIFEST

In order to support tox testing, config.mk is included in SDIST. This is not the best idea ever.

The resolution probably will fix issue #38 as well : handling dependencies.

For source installs, we shouldn't do it. Just install pyparsing and gmp yourself such that ld can find them and then run the standard python installation process

integer constructor loses modulus

>>> from charm.core.math.integer import integer
>>> x = integer(101)
>>> integer(33,x)
33
>>> integer(33,int(x))
33 mod 101

Expected behavior: both versions should give me 33 mod 101.

pyparsing does not install on ubuntu 12.04

Pyparsing 1.3 ships in ubuntu and we need 1.5.5. Because of the way ./configure works, we don't install our version. Moreover, we probably can't do the nieve install anyway since that would overwrite the system version

Source of randomness on Windows

Currently, the pairing module defaults to a deterministic PRNG since there is no /dev/urandom on Windows. Need to pull from the appropriate source of entropy for Win systems.

PairingGroup Segmentation Fault

Multiple calls to PairingGroup() within the same unit test suite results in a segmentation fault.

The following test class (tests/interface_ABEnc_test.py) succeeds if only one of the test* methods is invoked.
When two or more methods that contain a PairingGroup() statement, the test finishes with a segmentation fault.

class Test(unittest.TestCase):    
    def testIBE_bb03(self):
        group = PairingGroup('d224.param', 1024)
        M = group.random(GT)
        self.myCorrectnessTest(IBE_BB04, group, M)

    def testIBE_Franklin(self):
        group = PairingGroup('d224.param', 1024)
        M = "hello world!!"
        self.myCorrectnessTest(IBE_BonehFranklin, group, M)
 .
 .

if __name__ == "__main__":
    unittest.main()

PairingGroup missing group order

group = PairingGroup('a.param')
help(group)

No methods for retrieving the order of the group are found.
This is a feature feature request.
The group order is within the parameter file on the "r" line

Boneh Boyen 03/04 IBE scheme does not enforce that the id is a group element

Although identities need to be group elements in the boneh boyen scheme, it does not fail when passed a string. Instead it appears to implicitly convert ID to some group element in a way that is not deterministic (i.e. one cannot just encrypt to the identity string)

This is shown by the ibe_adapt_hybrid scheme

fix key extraction

Currently the symmetric key encryption abstraction takes a byte array as a key. Realistically, the question of how to extract
a symmetric key from a group element is not a question that should be defined by either the symmetric scheme or the hybrid scheme, it should be a property of what model we are working in.

fix integer pairing model to properly handle bytes and not unicode strings

Currently the integer module takes unicode strings. This is problematic because when some crypto system is realized using the integer library, we typically encrypt using a hybrid model that encodes the symmetric key in the integer model. Unfortunately, the unicode strings accepted currently don't actually represent the full entropy one would want for key material.

Ideally this should be fixed to use bytes in python 3 and fall back to python 2 style strings if necessary. In both cases, this would mean the ability to pass the full range of bits to the encoding function.

Intuition around the integer class

I find it a bit confusing the way the integer handles initial negative values.

To me it seems like integer(-3, 10000) would either error, or return the modular inverse of 3.
I would also expect integer(3) * -1 have similar behavior.

Instead we see behavior like
integer(3, 10000) * -1 #=> 55340232221128654845 mod 10000
integer(3) * -1 #=> 55340232221128654845

Upon inspection it makes perfect sense that this does not compute the intended result, but it can lead to hard to track down bugs.

I propose that if a negative number is applied to an integer (or a modular integer) an error or warning is displayed to the user.

Thanks for all the hard work,

Sky

Exponentiation Segmentation Fault

With traditional python objects, exponentiations on unsupported objects throws an error eg:

>>> b=b'test'
>>> b ** 3
Traceback (most recent call last):
 File "<input>", line 1, in <module>
 TypeError: unsupported operand type(s) for ** or pow(): 'bytes' and 'int'

However, when this is done with an element object, a segmentation fault is thrown.
Type checking is needed in order to avoid segmentation faults

>>> from charm.integer import *
>>> rand = init()
>>> p = rand.randomPrime(1024)
>>> b'test' ** p
Segmentation fault

hybrid encryption

it seems hybrid encryption should be a utility provided by the framework and not something we are writing everytime. Hoepfully it would be something you could compose by providing asymmetric scheme and a symmetric scheme.

exception when using (unreduced) exponents

Here's another problem I ran into:

>>> from charm.toolbox.integergroup import IntegerGroupQ
>>> g = IntegerGroupQ()
>>> g.paramgen(32)
>>> g.p
3673281863
>>> g.q
1836640931
>>> gen = g.randomGen()
>>> gen
114476042 mod 3673281863
>>> x = g.random()
>>> x
599153896 mod 1836640931
>>> y = g.random()
>>> y
996126290 mod 1836640931
>>> z = x - y
>>> z
-396972394 mod 1836640931
>>> gen ** z
zsh: floating point exception (core dumped)  python3

The problem is that z is not reduced to be in the range of [0, 1836640931), which results in a negative exponent being passed to GMP, which leads to an exception. I can fix this by adding a call to z.reduce() โ€” am I supposed to be making these calls after every arithmetic calculation?

Building with LLVM OS X

More of a reminder for myself... we need to exclusively support llvm for OS X 10.7+ as python installers from python.org will have the documented error:

/Developer/SDKs/MacOSX10.6.sdk/usr/include/stdarg.h:4:25: error: stdarg.h: No such file or directory
lipo: can't figure out the architecture type of: /var/folders/1d/6brkk4q10jq9fk81wvjgdjdw0000gn/T//ccE80Gx7.out
error: command 'gcc-4.2' failed with exit status 1
make: *** [build] Error 1

The problem is that stdarg.h in this particular directory is for llvm not gcc-4.2. The fix for this is:
CC=/usr/bin/gcc /Library/Frameworks/Python.framework/Versions/3.2/bin/python3.2 setup.py build

Handle dependencies

At the moment make tries to install gmp and pbc. Currently, it assumes they are not installed the first time it runs, then assumes that they are installed at any later point. The standard solution to this is to tell the user what is missing during ./configure.

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.