Skip to content
A simple PHP public key cryptography library
Latest commit e3eaa30 Sep 13, 2013 @xFlatlinex Merge pull request #3 from bitdeli-chef/master
Add a Bitdeli Badge to README

AsymmetriCrypt - Simple PHP public key cryptography

Build Status


Require asymmetricrypt/asymmetricrypt in your project's composer.json:

    "require": {
        "asymmetricrypt/asymmetricrypt": "0.1.*"

Now update or install your packages with composer update or composer install respectively.



use AsymmetriCrypt\Crypter;
use AsymmetriCrypt\Key\PublicKey;
use AsymmetriCrypt\Key\PrivateKey;

// Create a private key
$priv = Crypter::createPrivateKey();
// or
$priv = PrivateKey::create();

// Load a private key
$priv = Crypter::loadPrivateKey("file:///path/to/key.pem");
// or
$priv = new PrivateKey("file:///path/to/key.pem");

// Get derived public key
$pub = $priv->getPublicKey();

// Load a public key
$pub = Crypter::loadPublicKey("file:///path/to/");
// or
$pub = new PublicKey("file:///path/to/");

// Encrypt data
$encrypted = Crypter::encrypt("data to encrypt", $pub);

// Decrypt data
$decrypted = Crypter::decrypt($encrypted, $priv);

// Sign data
$signature = Crypter::sign("data to sign", $priv);

// Verify signature
$signature_valid = Crypter::verify("data to sign", $signature, $pub);


I'm still working on a detailed documentation, but I don't have an ETA.

Bitdeli Badge

Something went wrong with that request. Please try again.