2017 © Pedro Peláez
 

symfony-bundle url-encryptor-bundle

The NzoUrlEncryptorBundle is a Symfony Bundle used to Encrypt and Decrypt data and variables in the Web application or passed through URL

image

nzo/url-encryptor-bundle

The NzoUrlEncryptorBundle is a Symfony Bundle used to Encrypt and Decrypt data and variables in the Web application or passed through URL

  • Wednesday, March 28, 2018
  • by NAYZO
  • Repository
  • 5 Watchers
  • 28 Stars
  • 56,349 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 8 Forks
  • 0 Open issues
  • 19 Versions
  • 9 % Grown

The README.md

NzoUrlEncryptorBundle

tests Total Downloads Latest Stable Version, (*1)

The NzoUrlEncryptorBundle is a Symfony Bundle used to Encrypt and Decrypt data and variables in the Web application or passed through the URL to provide more security to the project. Also it prevent users from reading and modifying sensitive data sent through the URL., (*2)

The Version (^6.0) is compatible with Symfony >= 4.4

Features include:, (*3)

  • Url Data & parameters Encryption
  • Url Data & parameters Decryption
  • Data Encryption & Decryption
  • Access from Twig by ease
  • Flexible configuration
  • Uses OpenSSL extension

By default, this bundle use the aes-256-ctr algorithm., (*4)

CTR mode (without any additional authentication step) is malleable, which means that it is possible to change the meaning of the ciphertext and if the plaintext is guessable then it could lead to IDOR., (*5)

For more secure output, you must configure the bundle to use a unique and random IV (random_pseudo_bytes: TRUE)

Installation

Through Composer:

Install the bundle:, (*6)

$ composer require nzo/url-encryptor-bundle

Register the bundle in config/bundles.php (without Flex):

``` php // config/bundles.php, (*7)

return [ // ... Nzo\UrlEncryptorBundle\NzoUrlEncryptorBundle::class => ['all' => true], ];, (*8)


### Configure the bundle: ``` yml # config/packages/nzo_encryptor.yaml nzo_encryptor: secret_key: Your_Secret_Encryption_Key # Required, max length of 100 characters. secret_iv: Your_Secret_Iv # Required only if "random_pseudo_bytes" is FALSE. Max length of 100 characters. cipher_algorithm: # optional, default: 'aes-256-ctr' base64_encode: # optional, default: TRUE format_base64_output: # optional, default: TRUE, used only when 'base64_encode' is set to TRUE random_pseudo_bytes: # optional, default: TRUE (generate a random encrypted text output each time => MORE SECURE !)
* To generate the same cypher text each time: random_pseudo_bytes: FALSE (Not Secure)
* To generate a different cypher text each time: random_pseudo_bytes: TRUE (Secure)

Usage

In the twig template:

Use the twig extensions filters or functions to encrypt or decrypt your data:, (*9)

``` html // Filters:, (*10)

Encryption:

<a href="{{path('my-route', {'id': myId | nzo_encrypt } )}}"> My link </a>

{{myVar | nzo_encrypt }}

Decryption:

<a href="{{path('my-route', {'id': myId | nzo_decrypt } )}}"> My link </a>

{{myVar | nzo_decrypt }}

// Functions:, (*11)

Encryption:

<a href="{{path('my-path-in-the-routing', {'id': nzo_encrypt('myId') } )}}"> My link </a>

{{ nzo_encrypt(myVar) }}

Decryption:

<a href="{{path('my-path-in-the-routing', {'id': nzo_decrypt('myId') } )}}"> My link </a>

{{ nzo_decrypt(myVar) }}

#### In the controller with annotation service: Use the annotation service to ``decrypt`` / ``encrypt`` automatically any parameter you want, by using the ``ParamDecryptor`` / ``ParamEncryptor`` annotation service and specifying in it all the parameters to be decrypted/encrypted. ```php use Nzo\UrlEncryptorBundle\Annotations\ParamDecryptor; use Nzo\UrlEncryptorBundle\Annotations\ParamEncryptor; class MyController { /** * @ParamDecryptor({"id", "foo"}) OR #[ParamDecryptor(["id", "foo"])] */ public function decryptionAction($id, $foo) { // no need to use the decryption service here as the parameters are already decrypted by the annotation service. //... } /** * @ParamEncryptor({"id", "foo"}) OR #[ParamEncryptor(["id", "foo"])] */ public function encryptionAction($id, $foo) { // no need to use the encryption service here as the parameters are already encrypted by the annotation service. //... } }

With autowiring:

use Nzo\UrlEncryptorBundle\Encryptor\Encryptor;

class MyController
{
    private $encryptor;

    public function __construct(Encryptor $encryptor)
    {
        $this->encryptor = $encryptor;
    }

    public function indexAction($data) 
    {
        $encrypted = $this->encryptor->encrypt($data);

        $decrypted = $this->encryptor->decrypt($data);
    }
}    

Without autowiring:

class MyController
{
    public function indexAction($data) 
    {
        $encrypted = $this->get('nzo_encryptor')->encrypt($data);

        $decrypted = $this->get('nzo_encryptor')->decrypt($data);
    }
}    

License

This bundle is under the MIT license. See the complete license in the bundle:, (*12)

See LICENSE, (*13)

The Versions

28/03 2018

dev-master

9999999-dev

The NzoUrlEncryptorBundle is a Symfony Bundle used to Encrypt and Decrypt data and variables in the Web application or passed through URL

  Sources   Download

MIT

The Requires

 

The Development Requires

url security encrypt decrypt encryption link data variable id decryption

28/03 2018

4.2.0

4.2.0.0

The NzoUrlEncryptorBundle is a Symfony Bundle used to Encrypt and Decrypt data and variables in the Web application or passed through URL

  Sources   Download

MIT

The Requires

 

The Development Requires

url security encrypt decrypt encryption link data variable id decryption

28/03 2018

dev-upgrade

dev-upgrade

The NzoUrlEncryptorBundle is a Symfony Bundle used to Encrypt and Decrypt data and variables in the Web application or passed through URL

  Sources   Download

MIT

The Requires

 

The Development Requires

url security encrypt decrypt encryption link data variable id decryption

17/08 2017

4.1.0

4.1.0.0

The NzoUrlEncryptorBundle is a Symfony Bundle used to Encrypt and Decrypt data and variables in the Web application or passed through URL

  Sources   Download

MIT

The Requires

 

The Development Requires

url security encrypt decrypt encryption link data variable id decryption

30/03 2017

4.0

4.0.0.0

The NzoUrlEncryptorBundle is a Symfony Bundle used to Encrypt and Decrypt data and variables in the Web application or passed through URL

  Sources   Download

MIT

The Requires

 

The Development Requires

url security encrypt decrypt encryption link data variable id decryption

24/09 2016

3.1

3.1.0.0

The NzoUrlEncryptorBundle is a Symfony Bundle used to Encrypt and Decrypt data and variables in the Web application or passed through URL

  Sources   Download

MIT

The Requires

 

url security encrypt decrypt encryption link data variable id decryption

24/06 2016

3.0

3.0.0.0

The NzoUrlEncryptorBundle is a Symfony2/3 Bundle used to Encrypt and Decrypt data and variables in the Web application or passed through URL

  Sources   Download

MIT

The Requires

 

url security encrypt decrypt encryption link data variable id decryption

21/04 2016

2.1

2.1.0.0

The NzoUrlEncryptorBundle is a Symfony2 Bundle used to Encrypt and Decrypt data and variables in the Web application or passed through URL

  Sources   Download

MIT

The Requires

 

url security encrypt decrypt encryption link data variable id decryption

21/04 2016

2.0

2.0.0.0

The NzoUrlEncryptorBundle is a Symfony2 Bundle used to Encrypt and Decrypt data and variables in the Web application or passed through URL

  Sources   Download

MIT

The Requires

 

url security encrypt decrypt encryption link data variable id decryption

02/04 2016

1.9

1.9.0.0

The NzoUrlEncryptorBundle is a Symfony2 Bundle used to Encrypt and Decrypt data and variables in the Web application or passed through URL

  Sources   Download

MIT

The Requires

 

url security encrypt decrypt encryption link data variable id decryption

31/03 2016

1.8

1.8.0.0

The NzoUrlEncryptorBundle is a Symfony2 Bundle used to Encrypt and Decrypt data and variables in the Web application or passed through URL

  Sources   Download

MIT

The Requires

 

url security encrypt decrypt encryption link data variable id decryption

30/03 2016

1.7

1.7.0.0

The NzoUrlEncryptorBundle is a Symfony2 Bundle used to Encrypt and Decrypt data and variables in the Web application or passed through URL

  Sources   Download

MIT

The Requires

 

url security encrypt decrypt encryption link data variable id decryption

22/03 2016

1.6

1.6.0.0

The NzoUrlEncryptorBundle is a Symfony2 Bundle used to Encrypt and Decrypt data and variables in the Web application or passed through URL

  Sources   Download

MIT

The Requires

 

url security encrypt decrypt encryption link data variable id decryption

21/12 2015

1.5

1.5.0.0

The NzoUrlEncryptorBundle is a Symfony2 Bundle used to Encrypt and Decrypt data and variables in the Web application or passed through URL

  Sources   Download

MIT

The Requires

 

url security encrypt decrypt encryption link data variable id decryption

12/05 2015

1.4

1.4.0.0

The NzoUrlEncryptorBundle is a Symfony2 Bundle used to Encrypt and Decrypt data and variables in the Web application or passed through URL

  Sources   Download

MIT

The Requires

 

url security encrypt decrypt encryption link data variable id decryption

18/04 2015

1.3

1.3.0.0

The NzoUrlEncryptorBundle is a Symfony2 Bundle used to Encrypt and Decrypt data and variables in the Web application or passed through URL

  Sources   Download

MIT

The Requires

 

url security encrypt decrypt encryption link data variable id decryption

05/04 2015

1.2

1.2.0.0

The NzoUrlEncryptorBundle is a Symfony2 Bundle used to Encrypt and Decrypt data and variables in the Web application or passed through URL

  Sources   Download

MIT

The Requires

 

url security encrypt decrypt encryption link data variable id decryption

31/01 2015

1.1

1.1.0.0

The NzoUrlEncryptorBundle is a Symfony2 Bundle used to Encrypt and Decrypt data and variables in the Web application or passed through URL

  Sources   Download

MIT

The Requires

 

url security encrypt decrypt encryption link data variable id decryption

29/01 2015

1.0

1.0.0.0

The NzoUrlEncryptorBundle is a Symfony2 Bundle used to Encrypt and Decrypt data and variables in the Web application or passed through URL

  Sources   Download

MIT

The Requires

 

url security encrypt decrypt encryption link data variable id decryption