You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+29-70Lines changed: 29 additions & 70 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -5,21 +5,22 @@
5
5
<hrwidth="50%"/>
6
6
</div>
7
7
8
-
A PHP package for request encryption, designed for quickly implementing secure communication between frontend and backend.
8
+
A PHP toolkit for handling encrypted requests, enabling fast and secure front-end to back-end communication.
9
9
10
-
In real-world development, there are often scenarios where requests need extra security: data must be encrypted to prevent sniffing, and requests should be protected against tampering or replay attacks. Coordinating encryption methods and signature rules with frontend teams each time can be cumbersome. To simplify this workflow, I created this PHP package and a companion npm package, allowing frontend developers to generate encrypted request parameters with a single function call, making it easy to implement secure API communication.
10
+
In real-world development, you often encounter scenarios where requests need to be secure: data must be encrypted to prevent sniffing, and requests must be protected from tampering or replay attacks. Coordinating encryption methods and signature rules with the front-end can be cumbersome. This PHP package simplifies the process. Paired with a dedicated npm package, the front-end can generate encrypted request parameters with a single call, enabling secure and fast data transmission.
**This project has been parsed by Zread. If you need a quick overview of the project, you can click here to view it:[Understand this project](https://zread.ai/zxc7563598/php-encrypted-request)**
14
+
**This project has been parsed by Zread. To quickly understand it, you can click here:****[Learn More](https://zread.ai/zxc7563598/php-encrypted-request)**
15
15
16
16
## Features
17
17
18
-
- 🔐 AES-128-CBC decryption of frontend-encrypted data to prevent leaks
19
-
- ✍️ Dynamic MD5 signature verification to prevent forged signatures
20
-
- ⏰ Timestamp validation (in seconds) with configurable tolerance, to prevent request hijacking
21
-
- ⚙️ Configurable via `.env` file or array
22
-
- 🧩 Extensible with custom decryptors
18
+
- ♾️ **Hybrid encryption**: AES key is randomly generated, no need for front-end to store a fixed key, improving security
19
+
- 🔐 **AES-128-CBC decryption**: Securely decrypt front-end encrypted data, back-end only needs to configure the RSA private key
> In most cases, if your `AES_KEY`, `AES_IV`, and `APP_KEY` remain confidential, the default AES-128-CBC decryption is sufficient for secure API communication.
83
-
84
-
> Custom decryptors are mainly for special scenarios, such as using a completely different encryption algorithm or requiring higher security standards.
78
+
## Front-end Integration
85
79
86
-
> If your project demands extremely high confidentiality, it is recommended to design your own encryption rules rather than relying solely on the default AES implementation.
87
-
88
-
```php
89
-
class MyCustomDecryptor implements \Hejunjie\EncryptedRequest\Contracts\DecryptorInterface
$handler = new EncryptedRequestHandler($customDecryptor);
107
-
```
108
-
109
-
## Frontend Integration
110
-
111
-
Frontend can use the [hejunjie-encrypted-request](https://github.com/zxc7563598/npm-encrypted-request) npm package to generate encrypted data and send it to the PHP backend:
80
+
The front-end uses the [hejunjie-encrypted-request](https://github.com/zxc7563598/npm-encrypted-request) npm package to generate encrypted data and send it to the PHP back-end:
0 commit comments