php - Encryption between web service users -
i've got web service (similar online store) users save data. need encrypt data, managers , users read data.
every manager , user has own password stored hashed in database.
first i've thought use rsa(public/private keys), can't figure out how gain access encrypted data using different passwords of managers , users.
btw: can prompt user , manager enter password every time try access encrypted data (compare hashed 1 in database , decrypt secured data).
please , excuse me poor english. in advance!
edit: simplest way use hardcoded master-password both encryption/decryption, think very insecure.
edit2: ok, think i've got idea: 1. generate unique key 2. using symmetric encryption encrypt data unique key (1) 3. encrypt unique key (1) user's password , store user's credentials 4. encrypt unique key (1) manager's password , store manager's credentials
now when manager wants access data, prompt him password, decrypt hash (4), unique key (1) , decrypt secure data. decryption user same: (3)->(1)->data
so problem make available multiple users->user_data/managers, lol
edit3: forgot mention: users create data once , managers use internal use.
if don't mind prompting password every time user needs access data, might consider using mcrypt php module. make sure research before implementing anything, though. it's quite easy use insecurely if you're not careful.
Comments
Post a Comment