To make your life a little easier we created some commands that you can use for encrypting and decrypting your current database.
You can use the comment doctrine:encrypt:status
to get the current database and encryption information.
$ php app/console doctrine:encrypt:status
This command will return the amount of entities and the amount of properties with the @Encrypted tag for each entity. The result will look like this:
DoctrineEncrypt\Entity\User has 3 properties which are encrypted.
DoctrineEncrypt\Entity\UserDetail has 13 properties which are encrypted.
2 entities found which are containing 16 encrypted properties.
You can use the comment doctrine:encrypt:database [encryptor]
to encrypt the current database.
- Optional parameter [encryptor]
- An encryptor provided by the bundle (Defuse or Halite) or your own encryption class.
- Default: Your encryptor set in the configuration file or the default encryption class when not set in the configuration file
$ php app/console doctrine:encrypt:database
or you can provide an encryptor (optional).
$ php app/console doctrine:encrypt:database Defuse
$ php app/console doctrine:encrypt:database Halite
This command will return the amount of values encrypted in the database.
Encryption finished values encrypted: 203 values.
You can use the comment doctrine:decrypt:database [encryptor]
to decrypt the current database.
- Optional parameter [encryptor]
- An encryptor provided by the bundle (Defuse or Halite) or your own encryption class.
- Default: Your encryptor set in the configuration file or the default encryption class when not set in the configuration file
$ php app/console doctrine:decrypt:database
or you can provide an encryptor (optional).
$ php app/console doctrine:decrypt:database Defuse
$ php app/console doctrine:decrypt:database Halite
This command will return the amount of entities and the amount of values decrypted in the database.
Decryption finished entities found: 26, decrypted 195 values.
You may want to use your own encryption class learn how here: