« Back Issue #282
  • 2017-03-17 11:43 Reported by prana
  • 2017-05-13 09:01 Marked fixed
Status: Marked fixed
Priority: Medium

Adding an external database for added privacy

prana 2017-03-17 11:43

Deliverable 2 requires an external database for adding security to user's information as well as group's information.

prana 2017-03-17 11:45

Hi Professor,

I tried adding different functions(initializeSqlPrivate & createDatabaseTablesPrivate) for private db. Also added different handles for db class (private_db_class, private_dbinfo). But it’s still creating an empty default2.db. On the other hand, new table(TYPE_KEYS) actually gets added to default.db instead of default2.db. So some how, it’s not able to separate two different database objects.

Could you please have a look at my patch and let me know if you get any hints about what I may have done wrong.

Thanks, Pragya

administrator 2017-03-17 22:40

Hey Pragya,

I'll try to look at this tomorrow and see if I can figure out the problem.

Best, Chris

administrator 2017-03-19 10:08

Hi Pragya,

For the sqlite code above you have the two lines: + $private_db = new $private_db_class(); + $private_db->connect(); You can't use the version of connect without arguments for sqlite for the private database. This will connect you to the same database as the non-private one. Use something like: $private_db->connect(PRIVATE_DB_HOST, PRIVATE_DB_USER, PRIVATE_DB_PASSWORD, PRIVATE_DB_NAME); whenever you want to connect to the private database.

Best, Chris

prana 2017-03-21 16:23

Hi Professor,

It worked after passing parameters to private_db->connect(). Thanks for the help!

Pragya

prana 2017-04-03 14:50

Hi Professor,

Uploading new patch.

Main changes:

  • Added an external db
  • Added AES algorithm for encryption/decryption
  • When adding a new thread/comment in a group, encrypt each thread's Title & Description fields in the db.
  • When retrieving each thread's Title & Description from the db, decrypt using corresponding group's key from external db

Existing Issue:

  • Encryption/decryption steps have been excluded for two groups (Public & Wiki). It was giving error because the threads in these groups are created during CreateDB session. Need more time to debug it more.
prana 2017-04-10 23:43

Hi Professor,

Uploading new patch with additional changes:

  • Updated table 'Groups' with new column 'encryption'.
  • Added a field 'Encryption' in the UI when creating a new group. This gives
 an option to whether enable or disable encryption for the new group.

The only thing left is updating VersionFunctions.php for new database & 'Groups' table in existing db with new field 'Encryption'.

Pragya

prana 2017-04-17 22:57

Hi Professor,

Uploading a new patch with some fixes:

  • Updated VersionFunctions.php with version 50
  • Updated src/data/default.db & added src/data/default2.db
  • Fixed Edit Group form's Encryption field to display Enabled/Disabled instead of 0/1
  • Added more documentation in Cipher.php

Pragya

prana 2017-04-18 15:03

Hi Professor, Uploading new patch with minor changes:

  • Removed default*.db from the commit
  • More documentation

Pragya

administrator 2017-05-13 09:01

Hey Pragya,

Thanks your patch, it was applied with 0563d63.

Best, Chris

X