/phpcrypt

Provides a variety of cryptographic traits and classes to PHP

Primary LanguagePHPGNU General Public License v3.0GPL-3.0

PHPCrypt

Join the chat at https://gitter.im/shgysk8zer0/phpcrypt Build Status

Provides easy to use classes and traits for cryptographic functions using openssl_*. Intended to be compatible with JSCrypt & SubtleCrypto / JWK

Requires:

Installation:

Provided classes:

Provided traits:

Provided interfaces:

Example code:

<?php
set_include_path('/path/to/classes_dir/' . PATH_SEPARATOR . get_include_path());
spl_autoload_register('spl_autoload');

$keys = new \shgysk8zer0\PHPCrypt\KeyPair(PUBLIC_KEY, PRIVATE_KEY, PASSWORD);

$encrypted = $keys->encrypt(MESSAGE);
$decrypted = $keys->decrypt($encrypted);
$sig       = $keys->sign($encrypted);
$valid     = $keys->verify($encrypted, $sig);
$matches   = MESSAGE === $decrypted;