定制 bewor/php-cryptography 二次开发

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

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

bewor/php-cryptography

最新稳定版本:v2.0.0

Composer 安装命令:

composer require bewor/php-cryptography

包简介

Encryption Library

README 文档

README

Requirements

PHP 8.2 or higher.

Installation

Require this package in your composer.json and update composer. This will download the package.

composer require bewor/php-cryptography

Using

You can create a new Cryptography encrypter instance with any encrypt method allowed on openssl https://php.net/manual/en/function.openssl-encrypt.php.

    use Bewor\PhpCryptography\Encrypt;

    $encrypter = new Encrypt('aes-256-cbc', $publicKey);

    $data = '[data to encrypt]';

    $password = Encrypt::randomPassword();
    $encryptedPassword = $encrypter->encryptPublicKey($password);

    $encrypted = $encrypter->encrypt($data, $password);
    $base64encrypted = $encrypter->encryptBase64($data, $password);

or create a new Cryptography decrypter instance with any decrypt method allowed on openssl https://www.php.net/manual/en/function.openssl-decrypt.php.

    use Bewor\PhpCryptography\Decrypt;

    $decrypter = new Decrypt('aes-256-cbc', $privateKey);

    $data = '[data encrypted]';

    ...

    $decryptedPassword = $decrypter->decryptPrivateKey($password);

    $decrypted = $decrypter->decrypt($data, $decryptedPassword);
    $base64decrypted = $decrypter->decryptBase64($data, $decryptedPassword);

You can also work with files instead of content.

    use Bewor\PhpCryptography\Encrypt;
    use Bewor\PhpCryptography\Decrypt;

    $encrypter = new Encrypt('aes-256-cbc', $publicKey);
    $decrypter = new Decrypt('aes-256-cbc', $privateKey);

    $filePath = 'path/to/file';

    ...

    $encrypted = $encrypter->encrypt($filePath, $password, true);
    $base64encrypted = $encrypter->encryptBase64($filePath, $password, true);

    $decrypted = $decrypter->decrypt($filePath, $password, true);
    $base64decrypted = $decrypter->decryptBase64($filePath, $password, true);

统计信息

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

GitHub 信息

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

其他信息

  • 授权协议: MIT
  • 更新时间: 2024-06-05

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固