2017 © Pedro Peláez
 

yii2-extension yii2-rsa

yii2-rsa

image

xj/yii2-rsa

yii2-rsa

  • Thursday, August 20, 2015
  • by xjflyttp
  • Repository
  • 2 Watchers
  • 1 Stars
  • 369 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 4 Forks
  • 1 Open issues
  • 2 Versions
  • 49 % Grown

The README.md

yii2-rsa

composer.json

"require": {
    "xj/yii2-rsa": "*"
},

Rsa

openssl genrsa -out rsa_private_key.pem 2048
openssl rsa -in rsa_private_key.pem -pubout -out rsa_public_key.pem

example:

use xj\rsa\RsaPrivate;
use xj\rsa\RsaPublic;

//init
$privateKey = '@common/config/key-private.php';
$publicKey = '@common/config/key-public.php';
$str = 'yii2-rsa';

//private encrypt -> public decrypt
$privateEncryptString = RsaPrivate::model($privateKey)->encrypt($str);
$publicDecryptString = RsaPublic::model($publicKey)->decrypt($privateEncryptString);
var_dump('private', $str, $privateEncryptString, $publicDecryptString);

//public encrypt -> private decrypt
$publicEncryptString = RsaPublic::model($publicKey)->encrypt($str);
$privateDecryptString = RsaPrivate::model($privateKey)->decrypt($publicEncryptString);
var_dump('public', $str, $publicEncryptString, $privateDecryptString);

The Versions

20/08 2015

dev-master

9999999-dev

yii2-rsa

  Sources   Download

BSD-3-Clause

The Requires

 

by Avatar xjflyttp

14/08 2014

1.0.0

1.0.0.0

yii2-rsa

  Sources   Download

BSD-3-Clause

The Requires

 

by Avatar xjflyttp