firexsantos/esign-bsre-codeigniter

包 E-Sign BSrE 用于简化使用来自 BSSN (国家密码和安全委员会) 的 E-Sign BSrE (电子证书签发局) API

dev-main 2023-10-07 17:15 UTC

This package is auto-updated.

Last update: 2024-09-07 19:08:23 UTC


README

E-Sign BSrE

Latest Version on Packagist Total Downloads

E-Sign BSrE 是一个用于简化使用 BSSN 的 E-Sign API 的 PHP 包

安装

您可以通过 composer 安装此包

composer require firexsantos/esign-bsre-codeigniter

如果您使用 PHP 原生,请添加以下行

require 'vendor/autoload.php';

使用

代码

提供的代码包括不可见数字签名、数字签名验证和可见数字签名(即将推出)

  • 不可见数字签名
$esign = new FirmanSantosa\ESignBsreCodeIgniter\ESignBSrE($baseUrl, $username, $password);
$response = $esign->setFile($file, $filename)->sign($nik, $passphrase);
$response->getStatus(); //Get status response (int) - 404, 200 etc
$response->getErrors(); //Get error response
$response->getData(); //Get data as blob pdf
  • 数字签名验证
$esign = new FirmanSantosa\ESignBsreCodeIgniter\ESignBSrE($baseUrl, $username, $password);
$response = $esign->setFile($file, $filename)->verification();
$response->getStatus(); //Get status response (int)
$response->getErrors(); //Get error response
$response->getData(); //Get data as array (tergantung dari API BSrE)

示例代码:获取文件

有多种方法可以从应用程序中获取文件

  • 使用 GuzzleHttp 的 Utils
$file = GuzzleHttp\Psr7\Utils::tryFopen('/path/to/file.pdf', 'r')
  • 使用 file_get_contents
$file = file_get_contents('/path/to/file.pdf')

变更日志

查看 CHANGELOG 了解有关最新更改的更多信息。

贡献

查看 CONTRIBUTING 获取更多详细信息。

安全

如果您在此包中发现安全漏洞,请发送电子邮件至 diskominfotikbna[at]gmail.com

致谢

许可证

MIT 许可证 (MIT)。请参阅 许可证文件 获取更多信息。