https://github.com/blar/openssl-php
OpenSSL for PHP
https://github.com/blar/openssl-php
openssl php
Last synced: 6 months ago
JSON representation
OpenSSL for PHP
- Host: GitHub
- URL: https://github.com/blar/openssl-php
- Owner: blar
- License: other
- Created: 2014-08-30T15:43:05.000Z (almost 12 years ago)
- Default Branch: master
- Last Pushed: 2019-09-13T17:00:08.000Z (almost 7 years ago)
- Last Synced: 2025-06-16T10:07:17.222Z (about 1 year ago)
- Topics: openssl, php
- Language: PHP
- Size: 53.7 KB
- Stars: 12
- Watchers: 3
- Forks: 10
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Funding: .github/FUNDING.yml
- License: LICENSE.md
Awesome Lists containing this project
README
[](https://packagist.org/packages/blar/openssl)
[](https://packagist.org/packages/blar/openssl)
[](https://travis-ci.org/blar/openssl)
[](https://coveralls.io/github/blar/openssl?branch=master)
[](https://gemnasium.com/blar/openssl)
[](https://flattr.com/submit/auto?user_id=Blar&url=https%3A%2F%2Fgithub.com%2Fblar%2Fopenssl)
# 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](https://gemnasium.com/blar/openssl)
### Installation per Composer
$ composer require blar/openssl
### Installation per Git
$ git clone https://github.com/blar/openssl.git