PHPackages                             kigkonsult/openssltoolbox - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Utility &amp; Helpers](/categories/utility)
4. /
5. kigkonsult/openssltoolbox

ActiveLibrary[Utility &amp; Helpers](/categories/utility)

kigkonsult/openssltoolbox
=========================

the PHP OpenSSL Toolbox

v1.0.1(4y ago)531LGPL-3.0-or-laterPHPPHP &gt;=7.0 &lt;8.0

Since Jan 5Pushed 4y ago1 watchersCompare

[ Source](https://github.com/iCalcreator/OpenSSLToolbox)[ Packagist](https://packagist.org/packages/kigkonsult/openssltoolbox)[ Docs](https://kigkonsult.se)[ Fund](https://paypal.me/kigkonsult)[ RSS](/packages/kigkonsult-openssltoolbox/feed)WikiDiscussions master Synced today

READMEChangelogDependencies (8)Versions (4)Used By (0)

OpenSSLToolbox
--------------

[](#openssltoolbox)

provides object-oriented, secure and extended access to PHP OpenSSL functions

#### Conception basics

[](#conception-basics)

The OpenSSL pkey functions are assembled in the

- OpenSSLPkeyFactory class

The OpenSSL CSR functions are assembled in the

- OpenSSLCsrFactory class

The OpenSSL x509 functions are assembled in the

- OpenSSLX509Factory class

The OpenSSL pkcs7 functions are assembled in the

- OpenSSLPkcs7Factory class

The OpenSSL pkcs12 functions are assembled in the

- OpenSSLPkcs12Factory class

The OpenSSL spki functions are assembled in the

- OpenSSLSpkiFactory class

Remaining OpenSSL functions are assembled in the

- OpenSSLFactory class

Asserts and convenient salt, base64, hex, pack utility etc methods are assembled in the

- Assert class
- Convert class

#### Methods

[](#methods)

All methods have

- argument validation and throws InvalidArgumentException on error
- errorHandler protection and result error evaluation, throws RuntimeException on error

Method names originates from OpenSSL function names

- Ex 'openssl\_pkey\_export' is encapsulated in method OpenSSLPkeyFactory::export()

Most methods has also more convenient and describable named method alias

- Ex OpenSSLPkeyFactory::getPrivateKeyAsPemString() for 'openssl\_pkey\_export'

Most methods (ex setters) are chainable (ie return 'static')

The OO-classes, above, has 'factory' methods, support 'one-liners' and inherit usefull constants defind in the OpenSSLInterface

Supplementary methods for message digest / hmac digest support are assembled in the

- HashFactory class
- HmacHashFactory class

#### Example Usage

[](#example-usage)

Generate keys :

```
