PHP code example of oh86 / laravel-sm-beijing-ca

1. Go to this page and download the library: Download oh86/laravel-sm-beijing-ca 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/ */

    

oh86 / laravel-sm-beijing-ca example snippets


return [
    'driver' => env('SM_CRYPTOR_DRIVER', 'beijingCa'),

    'beijingCa' => [
        'baseUrl' => env('BEIJING_CA_BASEURL'),
        'appId' => env('BEIJING_CA_APPID'),
        'deviceId' => env('BEIJING_CA_DEVICE_ID'),
        'hmacKey' => env('BEIJING_CA_HMAC_KEY'),

        // 主密钥id(生成主密钥的时候不需要配置,待到加解密/哈希运算的时候需要配置)
        'sm4KeyId' => env('BEIJING_CA_SM4_KEY_ID'),
        'hmacKeyId' => env('BEIJING_CA_HMAC_KEY_ID'),
    ],
];
shell
# 生成主密钥(可用于`sm4KeyId`也可以用于`hmacKeyId`)
php artisan beijingCa:genMainKey