Documentation

Downloads

All downloads are packaged as PEAR packages and the current development release can be installed as follows:

pear install http://phpkeystore.org/download/Crypt_KeyStore-current.tgz

Basic Examples

<?php
    require_once 'Crypt/KeyStore.php';
    
    // get the key store instance
    $ks = Crypt_KeyStore::getInstance('DefaultKeyStore');

    // create a secret (symmetric) key
    $ks->createSecretKey('mykey', 'changeit');

    // encrypt some data
    $data = 'The quick brown fox jumped over the fence';
    $cipher = $ks->encrypt($data, 'mykey', 'changeit');

    // decrypt some data
    $decrypted = $ks->decrypt($cipher, 'mykey', 'changeit');

    // save the key store
    $ks->store('mykeystore.pks', 'changeit');

    // load a keystore file
    $ks->load('mykeystore.pks', 'changeit');

    // delete a key
    $ks->deleteEntry('mykey');

    // and so-on
?>

Contact