/openssl-php

OpenSSL for PHP

Primary LanguagePHPOtherNOASSERTION

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