blar / openssl
OpenSSL for PHP
Fund package maintenance!
www.paypal.me/blar
dev-master
2019-09-13 17:00 UTC
Requires
- php: ^7.0
- ext-openssl: *
- blar/common: dev-master
- blar/filesystem: dev-master
Requires (Dev)
- blar/hash: dev-master
- satooshi/php-coveralls: ^1.0
This package is auto-updated.
Last update: 2024-11-14 04:17:31 UTC
README
OpenSSL for PHP
Examples
Private Key
Create a new private key
$generator = new KeyGenerator();
$privateKey = $generator->generate();
Create a new private key with 2048 bit
$generator = new KeyGenerator();
$generator->setBits(2048);
$privateKey = $generator->generate();
Load an existing private key from file
$privateKey = PrivateKey::loadFromFileName('privatekey.pem');
Encrypt data with the private key.
$encrypted = $privateKey->encrypt('Hello World');
Get public key from private key.
$publicKey = $privateKey->getPublicKey();
Decrypt data with the public key
$publicKey->decrypt($encrypted);
Installation
Dependencies
Show dependencies of blar/openssl on gemnasium
Installation per Composer
$ composer require blar/openssl
Installation per Git
$ git clone https://github.com/blar/openssl.git