tourze / json-rpc-encrypt-bundle
JsonRPC加解密实现
Installs: 17
Dependents: 0
Suggesters: 0
Security: 0
Stars: 0
Watchers: 1
Forks: 0
Open Issues: 0
Type:symfony-bundle
Requires
- php: ^8.1
- ext-hash: *
- ext-openssl: *
- psr/log: ^3|^2|^1
- symfony/config: ^6.4
- symfony/dependency-injection: ^6.4
- symfony/event-dispatcher: ^6.4
- symfony/framework-bundle: ^6.4
- symfony/http-foundation: ^6.4
- symfony/http-kernel: ^6.4
- symfony/polyfill-php83: ^1.31
- tourze/json-rpc-caller-bundle: 0.0.*
- tourze/json-rpc-core: ^0.0.6
Requires (Dev)
- phpstan/phpstan: ^2.1
This package is auto-updated.
Last update: 2025-04-25 19:09:23 UTC
README
A Symfony bundle for encrypting and decrypting JsonRPC requests and responses, ensuring sensitive data security during transmission.
Features
- AES-256-CBC symmetric encryption for data transmission
- Automatic decryption for incoming requests, automatic encryption for outgoing responses
- Multi-AppID and multi-secret management
- Compatible with standard JsonRPC workflow
- Flexible event subscriber mechanism
Installation
- Requires PHP 8.1+
- Requires Symfony 6.0+
- Install via Composer:
composer require tourze/json-rpc-encrypt-bundle
- Requires
tourze/jsonrpc-caller-bundle
for AppID/secret management
Quick Start
- Register the bundle in your Symfony application:
return [ // ... Tourze\JsonRPCEncryptBundle\JsonRPCEncryptBundle::class => ['all' => true], ];
-
Configure
ApiCallerRepository
to provide appId and appSecret. -
Client requests must add
Encrypt-AppID
header and encrypt the payload using the corresponding appSecret with AES-256-CBC:
POST /jsonrpc HTTP/1.1 Encrypt-AppID: your-app-id Content-Type: application/json <encrypted payload>
- The server will automatically decrypt the request body and encrypt the response body.
Documentation
- See
DataEncryption.puml
or the generated flowchart for the encryption process. - Custom encryption logic is supported by extending the Encryptor service.
- For advanced usage and configuration, see the source code and inline comments.
Contributing
- Issues and PRs are welcome
- Follow PSR coding standards
- Please ensure new features are fully tested
License
- MIT License
- Copyright © Tourze Team
Changelog
See [CHANGELOG.md] (if available)