PHP code example of talk-lucky / dkms-laravel

1. Go to this page and download the library: Download talk-lucky/dkms-laravel 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/ */

    

talk-lucky / dkms-laravel example snippets


/**
 * @var DkmsClient $kmsClient
 */
$dkmsClient = app("dkms");
$encryptStr = $dkmsClient->encrypt(config("kms.keyId"), "明文");
$decryptStr = $dkmsClient->decrypt(config("kms.keyId"), "密文");
$bool = $dkmsClient->isValidEncryptVal("明文/密文");



return [
    "keyId" => env("KMS_KEY_ID", ""),

    "default" => "online",

    "drivers" => [
        "online" => [
            "protocol"         => "https",
            "endpoint"         => env("KMS_ENDPOINT", ""),
            "password"         => env("KMS_PASSWORD", ""),
            "clientKeyContent" => env("KMS_CLIENT_KEY_CONTENT", ""),
            "cainfo"           => env("KMS_CAINFO_PATH", ""),
        ],

        "mail" => [
            "protocol"         => "https",
            "endpoint"         => env("KMS_ENDPOINT", ""),
            "password"         => env("KMS_PASSWORD", ""),
            "clientKeyContent" => env("KMS_CLIENT_KEY_CONTENT", ""),
            "cainfo"           => env("KMS_CAINFO_PATH", ""),
            "keyId"            => env("KMS_KEY_ID", ""),
            "ciphertextBlob"   => env("KMS_CIPHERTEXT_BLOB", ""),
        ]
    ],
];