2017 © Pedro Peláez
 

propel-behavior propel-behavior-mysql-encryption

Behavior which allows you to encrypt columns using mysql

image

smolowik/propel-behavior-mysql-encryption

Behavior which allows you to encrypt columns using mysql

  • Wednesday, February 22, 2017
  • by smolowik
  • Repository
  • 1 Watchers
  • 0 Stars
  • 2 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 0 Forks
  • 0 Open issues
  • 2 Versions
  • 100 % Grown

The README.md

mysql_encryption behavior for propel 2.x

This behavior is written for propel 2.x and it uses mysql functions AES_ENCRYPT and AES_DECRYPT for encryption., (*1)

Instalation

composer require smolowik/propel-behavior-mysql-encryption

How to use

First you need to define the encryption key:, (*2)

Smolowik\Propel\Passphrase::createInstance("YOUR_SECRET_KEY");

Then, add the behavior to the table:, (*3)

<table name="author" phpName="Author">
    <column name="id" type="integer" required="true" primaryKey="true" autoIncrement="true"/>
    <column name="first_name" type="varchar" size="50" required="true"/>
    <column name="last_name" type="varchar" size="255" required="true"/>
    <column name="email" type="varchar" size="100" required="true"/>
    <behavior name="mysql_encryption">
        <parameter name="columns" value="first_name,last_name,email" />
    </behavior>
</table>

In this part you define which columns should be encrypted. In our example, this columns: first_name, last_name and email., (*4)

<parameter name="columns" value="first_name,last_name,email" />

After building the model and update the database schema, you should be able to use encrypted columns as with any other in the table. I use this behavior to getting the list (paginate) with searching and sorting. I use it also to read and write individual rows from the database. If you want to use it in a more sophisticated way, you should thoroughly test it yourself., (*5)

SpeedTest

Test was made on Author table with fields id, first_name, last_name and email. Fields first_name, last_name and email are encrypted. The table was 33097 lines., (*6)

With no encryption: - insert (1000 rows) 546ms - findByFirstName (10 rows) 37ms - paginate (page 20 with 50 items and orderedByFirstName) 31ms, (*7)

With encryption with mysql_encryption behavior - insert (1000 rows) 584ms - findByFirstName (10 rows) 128ms - paginate (page 20 with 50 items and orderedByFirstName) 139ms, (*8)

With encryption with uwdoem/encryption behavior - insert (1000 rows) 577ms - findByFirstName (10 rows) not available - paginate (page 20 with 50 items and orderedByFirstName) not available, (*9)

The Versions

22/02 2017

dev-master

9999999-dev

Behavior which allows you to encrypt columns using mysql

  Sources   Download

MIT

The Requires

 

The Development Requires

by Aleksander Smołowik

22/02 2017

1.0.0

1.0.0.0

Behavior which allows you to encrypt columns using mysql

  Sources   Download

MIT

The Requires

 

The Development Requires

by Aleksander Smołowik