2017 © Pedro Peláez
 

library phpseclib-bundle

PHP Secure Communications Library - Pure-PHP implementations of RSA, AES, SSH2, SFTP, X.509 etc. Created By Jim Wigginton and Modified to be a Symfony2 Bundle.

image

sinner/phpseclib-bundle

PHP Secure Communications Library - Pure-PHP implementations of RSA, AES, SSH2, SFTP, X.509 etc. Created By Jim Wigginton and Modified to be a Symfony2 Bundle.

  • Monday, October 3, 2016
  • by jgabrielsinner10
  • Repository
  • 1 Watchers
  • 6 Stars
  • 65,239 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 19 Forks
  • 8 Open issues
  • 1 Versions
  • 4 % Grown

The README.md

PhpseclibBundle - PHP Secure Communications Library modified to be a Symfony2 Bundle

PHP Secure Communications Library - Pure-PHP implementations of RSA, AES, SSH2, SFTP, X.509 etc. Created By Jim Wigginton and Modified to be a Symfony2 Bundle., (*1)

MIT-licensed pure-PHP implementations of an arbitrary-precision integer arithmetic library, fully PKCS#1 (v2.1) compliant RSA, DES, 3DES, RC4, Rijndael, AES, SSH-1, SSH-2, SFTP, and X.509, (*2)

Step 1: Download phpseclib-bundle using composer

Add FOSUserBundle in your composer.json:, (*3)

{
    "require": {
        ...
        "sinner/phpseclib-bundle": "dev-master"
        ...
    }
}

Now tell composer to download the bundle by running the command:, (*4)

``` bash $ php composer.phar update sinner/phpseclib-bundle, (*5)

or


``` bash
$ composer update sinner/phpseclib-bundle

Composer will install the bundle to your project's vendor/sinner directory., (*6)

Step 2: Activate PHPSecLibBundle in you Symfony2 Project

Edit the appKernel.php file in the $bundles array area:, (*7)

    //"app/appKernel.php"
    ...
    $bundles = array(
    ...
    new Sinner\Phpseclib\PhpseclibBundle();
    ...
    );
    ...

Step 3: Encrypt, Decrypt and Enjoy

Suppose that you have a User Entity..., (*8)


/** * Entity/Usuario.php * */ class Usuario { public $id; public $nombre; public $apellido; public $email; public $twitter; }

... and you want to save the User data on Encrypted Way (For example in a Session) from your Controller, (*9)


/** * Controller/DefaultController.php * */ use Sinner\Phpseclib\Crypt\Crypt_TripleDES as TripleDES; Class DefaultController extends Controller{ public fucntion indexAction(){ //... $usuario_obj = new Usuario(); $usuario_obj->id = 1; $usuario_obj->nombre = 'José Gabriel'; $usuario_obj->apellido = 'González Pérez'; $usuario_obj->email = 'jgabrielsinner10@gmail.com'; $usuario_obj->twitter = '@JGabrielTupac'; const KEY_ENCRYPT = '548c286a61462d896573567b7a30335d4959427e5c7a675e325b6c7a7c'; $_KEY_ENCRYPT = KEY_ENCRYPT; $encrypter = new TripleDES(); $encrypter->setKey($_KEY_ENCRYPT); $usuario_obj_encrypt = $encrypter->encrypt(serialize($usuario_obj)); $usuario = unserialize($encrypter->decrypt($usuario_obj_encrypt)); var_dump($usuario_obj_encrypt); var_dump($usuario); //... } }

The Versions

03/10 2016

dev-master

9999999-dev https://github.com/Sinner/PhpseclibBundle

PHP Secure Communications Library - Pure-PHP implementations of RSA, AES, SSH2, SFTP, X.509 etc. Created By Jim Wigginton and Modified to be a Symfony2 Bundle.

  Sources   Download

MIT

The Requires

  • php >=5.3.0

 

by Jose Gabriel Gonzalez

symfony2 cryptography crypt phpseclib jim wigginton sinner