A cryptography PHP 5.4 library.
This is a PHP5 library about the cryptography. The library uses the PHP openssl methods., (*1)
The recommended way to install Cryptography is through composer (claudusd/cryptography on packagist), (*3)
Just create a composer.json
file for your project:, (*4)
``` json { "require": { "claudusd/cryptography": "*" } }, (*5)
And run these two commands to install it: ``` bash $ curl -sS https://getcomposer.org/installer | php $ composer install
Now you can add the autoloader, and you will have access to the library:, (*6)
``` php <?php, (*7)
require 'vendor/autoload.php'; ```, (*8)
This part of the library is used for key generation for the public key encryption., (*9)
The KeyGeneration
abstract class have the methods getPrivateKey()
to get the private key
and getPublicKey()
to get the public key
., (*10)
The library have a default implementation for generation key for RSA encryption with 4096 bits's lenght. Each instance of this class generates a new pair of key., (*11)
The class for encryption and decryption implement the interface EncryptionInterface
and use two methods, encrypt()
and decrypt()
., (*12)
By default the library have 2 implementations :, (*13)
The class for hash implement the interface HashInterface
and use the method hash()
., (*14)
By default the library implement the SHA1 hash., (*15)
The signature class implement the interface SignatureInterface
and use two methods, sign()
and verify()
., (*16)
By default the library implement the data sign with a private key and verify with a public key., (*17)