jiajialu/aliyun-sdk-kms

aliyun-php-sdk-kms 封装,支持composer方式使用

2.5.0 2018-12-20 07:27 UTC

This package is not auto-updated.

Last update: 2023-09-23 05:52:20 UTC


README

介绍

阿里云SDK kms包重构,支持composer方式使用

安装教程

composer require jiajialu/aliyun-sdk-kms

使用说明

<?php
  
require "vendor/autoload.php";
  
use AliCloud\Core\Profile\DefaultProfile;
use AliCloud\Core\DefaultAcsClient;
use AliCloud\Kms\DecryptRequest; //根据不同的需要引入不同的request
  

$progile = DefaultProfile::getProfile("cn-hangzhou","<access-key-id>","<access-ket-secret>");

$client = new DefaultAcsClient($progile);
  
$req = new DecryptRequest();
$req->setAcceptFormat("JSON");
$req->setCiphertextBlob("clip-str-xxxxxx"); //密文字符串
  
//$req->setEncryptionContext(json_encode(["key"=>"val"])); //参考api说明

$resp = $client->getAcsResponse($req);
  
var_dump($resp);

//返回结果:Plaintext(明文字符串)
/*
 {
 "KeyId": "202b9877-5a25-46e3-a763-e20791b52868"
 "Plaintext": "Plaintext"
 "RequestId": "207596a2-36d3-4840-b1bd-f87044699bd7"
 }
 */


更多参考官方api文档kms官方api文档

参与贡献

  1. Fork 本仓库
  2. 新建 Feat_xxx 分支
  3. 提交代码
  4. 新建 Pull Request