定制 c-squared-solutions-llc/hmac-util 二次开发

按需修改功能、优化性能、对接业务系统,提供一站式技术支持

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

c-squared-solutions-llc/hmac-util

Composer 安装命令:

composer require c-squared-solutions-llc/hmac-util

包简介

PHP HMAC utility library for signing and verifying signed requests

README 文档

README

Hmac Util currently supports signing requests with an hmac signature. You will need to provide the following to the library.

  1. HMAC Credentials (Username, Secret)
  2. HMAC Algorithm you would like to use
  3. Request Line (see HTTP REQUEST STANDARDS https://www.w3.org/Protocols/rfc2616/rfc2616-sec5.html)
  4. Body of the request (if any)
  5. Headers you wish to sign with (do not include headers you are sending but do not want as part of signature)

Example of use below

<?php

$hmac_request = new CSquaredSolutionsLlc\HmacUtil\HmacRequest();

$hmac_request->setAlgorithm('sha256');
$hmac_request->setCreds("testing","testing");

$hmac_request->request_line = 'POST /test HTTP/1.1';

$hmac_request->body = '{test: 1}';

$hmac_request->headers = [
	'Content-Type' => 'application/json',
	'Content-Length' => 115252
];

$hmac_util = new CSquaredSolutionsLlc\HmacUtil\HmacUtil();

$hmac_request = $hmac_util->sign($hmac_request);

After you get the HmacRequest object back, it will contain an authorization header and possibly two more headers for the signature. Send all headers, plus any others you want, and the body from the HmacRequest object via any restful library that supports it.

统计信息

  • 总下载量: 8
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 0
  • 点击次数: 0
  • 依赖项目数: 0
  • 推荐数: 0

GitHub 信息

  • Stars: 0
  • Watchers: 1
  • Forks: 0
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2020-08-15

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固