0

I suppose to make a web application where the users can login in this platform with username and password (I want to make a MySQL database to stare username and password).

After when the user is logged, he selects a file from his computer and send this file on server.

I want encrypt this file to a group of users (I want use HybridABE cryptography with Charm Crypto).

Now I have these architectural/programming question.

Suppose that we have this program:

from charm.toolbox.pairinggroup import PairingGroup,GT
from charm.adapters.abenc_adapt_hybrid import HybridABEnc as HybridABEnc
from charm.schemes.abenc.abenc_waters09 import CPabe09

group = PairingGroup('SS512')
cpabe = CPabe09(group)

hyb_abe = HybridABEnc(cpabe, group)

policy = '((ONE or THREE) and (TWO or FOUR))'

msg = "hello world this is an important message."

(master_secret_key, master_public_key) = hyb_abe.setup()

attr_list = ['THREE', 'ONE', 'TWO']

secret_key = hyb_abe.keygen(master_public_key, master_secret_key, attr_list)

cipher_text = hyb_abe.encrypt(master_public_key, msg, policy)

decrypted_msg = hyb_abe.decrypt(master_public_key, secret_key, cipher_text)

Where can I save the Master Private Key and the Master Public Key ? On a directory server like file ? On database ?

Where can I save the secret key of user ?

JLo
  • 53
  • 1
  • 7

1 Answers1

0

An Attribute-based Encryption system is usually created once and has only one master secret key and public key pair.

  • The master secret key is stored on the server that generates the user secret keys. Since there is usually only one master secret key, you can even generate it and put it into the source code of your server code. Of course, you can include it in the server database.
  • User secret keys have to be given to users. Remember to give your users some kind of (public) identifier along with the user secret key so that you can manage the list of attributes that a certain user has at the server-side. Otherwise, you will have a headache when you try to update attributes, because you will need to contact users with their new user secret key.
  • The master public key (usually called "public parameters" or simply "public key") is public. It's a good idea to include it in the package that you give to your users. You can also create an API endpoint so that interested "users" can ask your server for the public key.
Artjom B.
  • 61,146
  • 24
  • 125
  • 222
  • simply and clear. One thing: when you say that the user secret keys have to be given ti user, how can you send these keys ? And how/where can you store these Key ? Can you give me an example of point 2 ? – JLo Sep 14 '16 at 19:11
  • 1
    A key usually consists of multiple values (e.g. elements of the pairing group). Those are separately serializable into bytes and Charm provides the [necessary functions to do so](http://stackoverflow.com/a/34447301/1816580). Now, the challenge is to put the multiple serialized values into a (file-) format. There are countless ways to do this. You could put the serialized values into a different object that only uses native Python types then [pickle it](https://docs.python.org/2/library/pickle.html). You could write your own file format. You could use something like Protobuf. – Artjom B. Sep 16 '16 at 17:54
  • Can you explain me how can an user does encrypt the data client side with the Master Public Key ? I'm developing a web app, and I don't know how can I encrypt the Data with a Key released from Charm Crypto (server side). Can I use JavaScript ? (Client Side I can't use Pyhton because it is a web app). Thanks for tour support. – JLo Sep 16 '16 at 21:54
  • You can write your code in C or C++ with the PBC library and then use emscripten to compile it to JavaScript. Charm uses the PBC library under the hood. You could also use [this library](https://github.com/jorgenhoc/jspairings), but I don't know how compatible it is to Charm. Before you actually do this, you will have to think about what it means if the user stores has their secret key in the browser and how it is getting there. You should quickly arrive at multiple problems and you'll probably scrape the whole idea. – Artjom B. Sep 16 '16 at 22:08
  • Ok. Can you ever try to use Charm Crypto client Side with Brython or Skulpt ? Is there a possibility that it works ? – JLo Sep 16 '16 at 22:36
  • I don't know. Have you tried it? But somehow I doubt that those will let you use a native c module which Charm uses under the hood. – Artjom B. Sep 16 '16 at 22:45
  • Note that Stack Overflow is not a discussion forum. If you have further question, you should post separate questions. – Artjom B. Sep 16 '16 at 22:46
  • Ok. (Now I read the upside comment updated)->However is not necessary that user store his private Key because the decryption is server side. – JLo Sep 16 '16 at 22:51
  • If the decryption is server-side, then you probably don't need ABE at all. – Artjom B. Sep 16 '16 at 22:54
  • Sorry, but i really don't understand what do you mean when you explain the 2 point in comment?. If the decryption Is client side, how can I send the private Key to user generated server side ? Like a cookie ? Sorry but i don't understand. – JLo Sep 16 '16 at 23:01
  • That's the general problem of ABE. The user secret key has to be distributed to users somehow, but nowhere is defined how (it is largely an academic exercise till now). Preferably, the user secret key is given to users in an out of bound way. – Artjom B. Sep 16 '16 at 23:04