PHP code example of kronos / encrypt

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

    

kronos / encrypt example snippets


$aes = new \Kronos\Encrypt\Cipher\AES();

$kms_client = new \Aws\Kms\KmsClient([
      'credentials' => [
              'key' => 'AWS user key',
              'secret' => 'AWS user secret',
      ],
      'region' => "us-east-1",
      'version' => 'latest',
]);

$key = new \Kronos\Encrypt\KeyProvider\KMS\KeyDescription();
$key->ciphertextBlob = "Base64EncodedCiphertextBlob";

$kms = new \Kronos\Encrypt\KeyProvider\KMS($kms_client, $key);

$service = new \Kronos\Encrypt\TextCrypt($aes, $kms);
echo $service->decrypt($service->encrypt(file_get_contents($argv[1])));