承接 mervick/aes-bridge 相关项目开发

从需求分析到上线部署,全程专人跟进,保证项目质量与交付效率

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

mervick/aes-bridge

Composer 安装命令:

composer require mervick/aes-bridge

包简介

AesBridge is a modern, secure, and cross-language AES encryption library

README 文档

README

Packagist Version CI Status

AesBridge is a modern, secure, and cross-language AES encryption library. It offers a unified interface for encrypting and decrypting data across multiple programming languages. Supports GCM, CBC, and legacy AES Everywhere modes.

This is the PHP implementation of the core project.
👉 Main repository: https://github.com/mervick/aes-bridge

Features

  • 🔐 AES-256 encryption in GCM (recommended) and CBC modes
  • 🌍 Cross-Platform: Consistent behavior across different languages
  • 📦 Compact binary format or base64 output
  • ✅ HMAC Integrity: CBC mode includes HMAC verification
  • 🔄 Backward Compatible: Supports legacy AES Everywhere format

Requirements

  • PHP 7.4 or higher
  • OpenSSL extension

Installation

composer require mervick/aes-bridge:"^2.0"

Basic Usage

use AesBridge\Gcm;
use AesBridge\Cbc;

// encrypt/decrypt using GCM mode (recommended)
$ciphertext = Gcm::encrypt("My secret message", "MyStrongPass")
$plaintext = Gcm::decrypt($ciphertext, "MyStrongPass")

// encrypt/decrypt using CBC mode
$ciphertext = Cbc::encrypt("My secret message", "MyStrongPass")
$plaintext = Cbc::decrypt($ciphertext, "MyStrongPass")

API Reference

GCM Mode (recommended)

  • Gcm::encrypt(data, passphrase)
    Encrypts a string using AES-GCM. Returns: base64-encoded string.

  • Gcm::decrypt(ciphertext, passphrase)
    Decrypts a base64-encoded string encrypted with Gcm::encrypt.

  • Gcm::encryptBin(data, passphrase)
    Returns encrypted binary data using AES-GCM.

  • Gcm::decryptBin(ciphertext, passphrase)
    Decrypts binary data encrypted with Gcm::encryptBin.

CBC Mode

  • Cbc::encrypt(data, passphrase)
    Encrypts a string using AES-CBC. HMAC is used for integrity verification.
    Returns: base64-encoded string.

  • Cbc::decrypt(ciphertext, passphrase)
    Decrypts a base64-encoded string encrypted with Cbc::encrypt and verifies HMAC.

  • Cbc::encryptBin(data, passphrase)
    Returns encrypted binary data using AES-CBC with HMAC.

  • Cbc::decryptBin(ciphertext, passphrase)
    Decrypts binary data encrypted with Cbc::encryptBin and verifies HMAC.

Legacy Compatibility

⚠️ These functions are kept for backward compatibility only. Their usage is strongly discouraged in new applications.

  • Legacy::encrypt(data, passphrase)
    Encrypts a string in the legacy AES Everywhere format.

  • Legacy::decrypt(ciphertext, passphrase)
    Decrypts a string encrypted in the legacy AES Everywhere format.

Error Handling

All methods throw exceptions for:

  • Invalid input data
  • Incorrect passwords
  • Corrupted ciphertext
  • HMAC verification failures (CBC mode)

统计信息

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

GitHub 信息

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

其他信息

  • 授权协议: MIT
  • 更新时间: 2025-07-16

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固