1. Go to this page and download the library: Download juanchosl/cryptology library. Choose the download type require.
2. Extract the ZIP file and open the index.php.
3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
juanchosl / cryptology example snippets
$crypter = new Password;
$crypter->setPassword('myPassword');
$crypted_message = $crypter->encrypt('A message to encrypt');
$decrypter = new Password;
$decrypter->setPassword('myPassword');
$decrypted_message = $decrypter->decrypt($crypted_message);
$crypter = new PrivateKey;
$crypter->setPrivateKey('/path/to/private_key.key');
$crypted_message = $crypter->encrypt('A message to encrypt');
$decrypter = new PublicKey;
$decrypter->setPublicKey('/path/to/public_key.pub');
$decrypted_message = $decrypter->decrypt($crypted_message);
$crypter = new Pkcs1;
$crypter->setRemotes(['/path/to/receiver/certificate.crt']);
$crypted_message = $crypter->encrypt('A message to encrypt');//An array with the crypted message in first position and an array with the passphrases as second element of the response
$decrypter = new Pkcs1;
$decrypter->setPrivateKey('/path/to/my/private_key.key');
$decrypter->setPublicKey('/path/to/public_key.pub');
$decrypter->setPassword('message_password');
$decrypted_message = $decrypter->decrypt($crypted_message);
$crypter = new Pkcs1;
$crypter->setRemotes(['/path/to/receiver/certificate.crt']);
$crypter->setPrivateKey('/path/to/my/private_key.key');
$signed_message = $crypter->sign('A message to sign');
$decrypter = new Pkcs1;
$decrypter->setRemotes(['/path/to/sender/certificate.crt']);
$message = $decrypter->verify($signed_message);
$crypter = new Pkcs7;
$crypter->setRemotes(['/path/to/receiver/certificate.crt']);
$crypted_message = $crypter->encrypt('A message to encrypt');
$decrypter = new Pkcs7;
$decrypter->setPrivateKey('/path/to/my/private_key.key');
$decrypter->setCertificate('/path/to/my/certificate.crt');
$decrypter->setRemotes(['/path/to/sender/certificate.crt']);
$decrypted_message = $decrypter->decrypt($crypted_message);
$crypter = new Pkcs7;
$crypter->setPrivateKey('/path/to/my/private_key.key');
$crypter->setCertificate('/path/to/my/certificate.crt');
$signed_message = $crypter->sign('A message to encrypt');
$decrypter = new Pkcs7;
$decrypter->setRemotes(['/path/to/sender/certificate.crt']);
$message = $decrypter->verify($signed_message);
$crypter = new Cms;
$crypter->setRemotes(['/path/to/receiver/certificate.crt']);
$crypted_message = $crypter->encrypt('A message to encrypt');//An array with the crypted message in first position and an array with the passphrases as second element of the response
$decrypter = new Cms;
$decrypter->setPrivateKey('/path/to/my/private_key.key');
$decrypter->setCertificate('/path/to/my/certificate.crt');
$decrypted_message = $decrypter->decrypt($crypted_message);
$crypter = new Cms;
$crypter->setRemotes(['/path/to/receiver/certificate.crt']);
$crypter->setPrivateKey('/path/to/my/private_key.key');
$decrypter->setCertificate('/path/to/my/certificate.crt');
$signed_message = $crypter->sign('A message to sign');
$decrypter = new Cms;
$decrypter->setRemotes(['/path/to/sender/certificate.crt']);
$message = $decrypter->verify($signed_message);
$crypter = new Gnupg;
$crypter->setRemotes(['/path/to/receiver/certificate.crt']);
$crypted_message = $crypter->encrypt('A message to encrypt');//An array with the crypted message in first position and an array with the passphrases as second element of the response
$decrypter = new Gnupg;
$decrypter->setPrivateKey('/path/to/my/private_key.key');
$decrypted_message = $decrypter->decrypt($crypted_message);
$crypter = new Gnupg;
$crypter->setRemotes(['/path/to/receiver/certificate.crt']);
$crypter->setPrivateKey('/path/to/my/private_key.key');
$signed_message = $crypter->sign('A message to sign');
$decrypter = new Gnupg;
$decrypter->setPrivateKey('/path/to/my/private_key.key');
$decrypter->setRemotes(['/path/to/sender/certificate.crt']);
$message = $decrypter->verify($signed_message);
$crypter = new GpgConsole;
$crypter->setRemotes(['receiver_fingerprint']);
$crypted_message = $crypter->encrypt('A message to encrypt');//An array with the crypted message in first position and an array with the passphrases as second element of the response
$decrypter = new GpgConsole;
$decrypter->setPrivateKey('private_fingerprint');
$decrypted_message = $decrypter->decrypt($crypted_message);
$crypter = new GpgConsole;
$crypter->setPrivateKey('private_fingerprint');
$crypter->setRemotes(['receiver_fingerprint']);
$signed_message = $crypter->sign('A message to sign');
$decrypter = new GpgConsole;
$decrypter->setPrivateKey('private_fingerprint');
$decrypter->setRemotes(['sender_fingerprint']);
$message = $decrypter->verify($signed_message);
$crypter = new Mcrypt;
$crypter->setPassword('myPassword');
$crypted_message = $crypter->encrypt('A message to encrypt');
$decrypter = new Mcrypt;
$decrypter->setPassword('myPassword');
$decrypted_message = $decrypter->decrypt($crypted_message);
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.