PHP code example of wizofgoz / cryptographer

1. Go to this page and download the library: Download wizofgoz/cryptographer 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/ */

    

wizofgoz / cryptographer example snippets


'default-driver' => 'default',
'default-key'    => 'default',

'drivers' => [
    'default' => [
        'engine' => 'openssl',
        'cipher' => OpenSslEngine::CIPHER_AES_128,
        'key'    => 'default',
    ],
],

'default' => [
    'driver' => 'local',
    'value' => env('APP_KEY'),
],

'kms' => [
    'driver'     => 'aws',
    'value'      => env('AWS_DATA_KEY'), // encrypted value of the local data key
    'region'     => 'us-west-2',
    'profile'    => 'default', // credentials to use from ~/.aws/credentials file
    'master-key' => 'key_id_for_making_data_key', // ARN or key ID of master key to use
    'context'    => [], // optional key/values for authenticating key material
],

use Illuminate\Support\Facades\Crypt;

$encrypted = Crypt::driver('something')->encrypt('Hello world.');

$encrypted = ncrypt('some value', 'driver_name');

$plaintext = dcrypt($encrypted, 'driver_name');

public function register()
{
    $this->app->resolving('encrypter', function ($encrypter) {
        $encrypter->extend('engine_name', function ($config) {
            return new CustomEngine($config);
        });
    });
}

public function register()
{
    $this->app->resolving('key-manager', function ($km) {
        $km->extend('driver_name', function ($config) {
            return new CustomDriver($config);
        });
    });
}