blar/openssl

OpenSSL for PHP

dev-master 2019-09-13 17:00 UTC

This package is auto-updated.

Last update: 2024-04-14 02:55:58 UTC


README

License Latest Stable Version Build Status Coverage Status Dependency Status Flattr

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