<?php 
namespace app\bsadmin\model;

use think\Model;

class ApiApp extends Model
{
    /**
     * [encryptionAppKey 加密APP Key]
     * @param  string $value [description]
     * @return [type]        [description]
     */
    public static function encryptionAppKey()
    {
        $res = openssl_pkey_new([
            "private_key_bits" => 1024,
            "private_key_type" => OPENSSL_KEYTYPE_RSA
        ]);
        openssl_pkey_export($res, $privKey);
        $pubKey = openssl_pkey_get_details($res);
        $pubKey = $pubKey["key"];
        return [
            'privKey'   =>  $privKey,
            'pubKey'    =>  $pubKey
        ];
    }
}