2017 © Pedro Peláez
 

library doctrine-cache-encrypter

An encrypting decorator for instances of Doctrine\Common\Cache\Cache

image

jsq/doctrine-cache-encrypter

An encrypting decorator for instances of Doctrine\Common\Cache\Cache

  • Monday, May 23, 2016
  • by jeskew
  • Repository
  • 1 Watchers
  • 2 Stars
  • 1,031 Installations
  • PHP
  • 1 Dependents
  • 0 Suggesters
  • 0 Forks
  • 0 Open issues
  • 7 Versions
  • 19 % Grown

The README.md

Doctrine Cache Encrypter

Build Status Scrutinizer Code Quality Code Coverage Apache 2 License Total Downloads Author, (*1)

Having to encrypt your data at rest shouldn't keep you from using the open-source tools you know and love. If you have data that needs a higher degree of security than the rest of your cache, you can store and access it via an EncryptingDecorator., (*2)

Caveats

Encryption and decryption are both expensive operations, and frequent reads from an encrypted data store can quickly become a bottleneck in otherwise performant applications. Use encrypted caches sparingly (i.e., do not use an encrypting decorator around your Doctrine Annotations cache)., (*3)

Usage

This package provides two cache decorators, one that encrypts data using a pass phrase and one that does so with public and private keys. The implementation using a pass phrase is the more performant of the two but requires that you securely deploy a plaintext password., (*4)

First, create your Doctrine-based cache as you normally would:, (*5)

$cache = new \Doctrine\Common\Cache\RedisCache($redisClient);

Second, wrap your cache with an encrypting decorator:, (*6)

$encryptedCache = new \Jsq\Cache\PasswordEncryption\Decorator(
    $cache,
    $password,
    $cipher // optional, defaults to 'aes-256-cbc'
);

Then use your $cache and $encryptedCache like you normally would:, (*7)

$cache->save('normal_cache_data', 'Totally normal!');

$encryptedCache->save('api_keys', $keys);

Though your regular cache and encrypted cache share a storage layer and a keyspace, they will not be able to read each other's data. The $encryptedCache will return false if asked to read unencrypted data, and the regular $cache will return gibberish if asked to read encrypted data., (*8)

Encrypting your cache without sharing secrets

If you'd rather not rely on a shared password, the EnvelopeEncryption\Decorator can secure your sensitive cache entries using a public/private key pair., (*9)

$encryptedCache = new \Jsq\Cache\EnvelopeEncryption\Decorator(
    $cache,
    'file:///path/to/certificate.pem',
    'file:///path/to/private/key.pem',
    $passphrase_for_private_key_file, // optional, defaults to null
    $cipher // optional, defaults to 'aes-256-cbc'
);

The certificate can be a valid x509 certificate, a path to a PEM-encoded certificate file (the path must be prefaced with file://), or a PEM-encoded certificate string. The private key can be a path to a PEM-encoded private key file (the path must be prefaced with file://), or a PEM-encoded certificate string., (*10)

The Versions

23/05 2016

dev-master

9999999-dev

An encrypting decorator for instances of Doctrine\Common\Cache\Cache

  Sources   Download

Apache-2.0

The Requires

 

The Development Requires

by Jonathan Eskew

23/05 2016

dev-feature/php-70-upgrade

dev-feature/php-70-upgrade

An encrypting decorator for instances of Doctrine\Common\Cache\Cache

  Sources   Download

Apache-2.0

The Requires

 

The Development Requires

by Jonathan Eskew

22/02 2016

0.4.0

0.4.0.0

An encrypting decorator for instances of Doctrine\Common\Cache\Cache

  Sources   Download

Apache-2.0

The Requires

 

The Development Requires

by Jonathan Eskew

27/01 2016

0.3.0

0.3.0.0

An encrypting decorator for instances of Doctrine\Common\Cache\Cache

  Sources   Download

Apache-2.0

The Requires

 

The Development Requires

by Jonathan Eskew

09/09 2015

0.2.0

0.2.0.0

An encrypting decorator for instances of Doctrine\Common\Cache\Cache

  Sources   Download

Apache-2.0

The Requires

 

The Development Requires

by Jonathan Eskew

06/09 2015

0.1.0

0.1.0.0

An encrypting decorator for instances of Doctrine\Common\Cache\Cache

  Sources   Download

Apache-2.0

The Requires

 

The Development Requires

by Jonathan Eskew

04/09 2015

0.0.1

0.0.1.0

An encrypting decorator for instances of Doctrine\Common\Cache\Cache

  Sources   Download

Apache-2.0

The Requires

 

The Development Requires

by Jonathan Eskew