Download the PHP package madmatt/silverstripe-encrypt-at-rest without Composer

On this page you can find all versions of the php package madmatt/silverstripe-encrypt-at-rest. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.

FAQ

After the download, you have to make one include require_once('vendor/autoload.php');. After that you have to import the classes with use statements.

Example:
If you use only one package a project is not needed. But if you use more then one package, without a project it is not possible to import the classes with use statements.

In general, it is recommended to use always a project to download your libraries. In an application normally there is more than one library needed.
Some PHP packages are not free to download and because of that hosted in private repositories. In this case some credentials are needed to access such packages. Please use the auth.json textarea to insert credentials, if a package is coming from a private repository. You can look here for more information.

  • Some hosting areas are not accessible by a terminal or SSH. Then it is not possible to use Composer.
  • To use Composer is sometimes complicated. Especially for beginners.
  • Composer needs much resources. Sometimes they are not available on a simple webspace.
  • If you are using private repositories you don't need to share your credentials. You can set up everything on our site and then you provide a simple download link to your team member.
  • Simplify your Composer build process. Use our own command line tool to download the vendor folder as binary. This makes your build process faster and you don't need to expose your credentials for private repositories.
Please rate this library. Is it a good library?

Informations about the package silverstripe-encrypt-at-rest

silverstripe-encrypt-at-rest

github actions

This module allows Silverstripe CMS ORM data to be encrypted before being stored in the database, and automatically decrypted before using within your application. To do this, we use a secret key known only by the web server.

Caveats to understand

Requirements

Installation

Install via Composer:

Once installed, you need to generate an encryption key that will be used to encrypt all data.

  1. Generate a hex key with vendor/bin/generate-defuse-key (tool supplied by defuse/php-encryption). This will output a ASCII-safe key that starts with def.
  2. Set this key as the environment variable ENCRYPT_AT_REST_KEY.

For development environments you can set this in your .env e.g:

For more information view SilverStripe Environment Management.

Usage

In your DataObject, create new database fields using an encrypted field type. Note: It's not supported to convert an existing field that has data into an encrypted field. This might work but is not guaranteed. You should migrate your data by creating a new field, and creating a task to map old fields to new encrypted fields if necessary.

For example:

See the src/FieldType folder for all field types, or review the below list:

Note: When saving in the database, all of these encrypted fields are stored as TEXT column types. This is due to the length of the encrypted data being generally much longer than the original text string. They do not take up table column space, but result in longer query execution times when many fields are included as the database needs to go retrieve all these fields from separate blob storage.

Note 2: These fields all extend from the base data type (e.g. EncryptedDatetime extends DBDatetime) so most common field helper methods can be used (e.g. $DatetimeField.Ago).

Data will be automatically encrypted when values are written to the database, and decrypted whenever that data is read back from the database.

To use decrypted values, you just use the value like you would in any other context. For example:

Usage within Silverstripe templates is also straightforward:

If you've use the Silverstripe CMS 3 version of this module, you no longer need to rely on the ->getDecryptedValue() method - the value will always be decrypted when accessing it.

Encrypting and decrypting arbitrary text strings and files without using the ORM

You can also encrypt/decrypt arbitrary text strings as well as entire files on the filesystem without using the Silverstripe ORM (e.g. without using DataObject). You might want to do this to securely communicate with an API for example.


All versions of silverstripe-encrypt-at-rest with dependencies

PHP Build Version
Package Version
Requires php Version ^8.0
silverstripe/framework Version ^5
defuse/php-encryption Version ^2.2
Composer command for our command line client (download client) This client runs in each environment. You don't need a specific PHP version etc. The first 20 API calls are free. Standard composer command

The package madmatt/silverstripe-encrypt-at-rest contains the following files

Loading the files please wait ....