-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
0 parents
commit c188a9f
Showing
11 changed files
with
2,310 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
/vendor |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
MIT License | ||
|
||
Copyright (c) 2021 Claude Fassinou | ||
|
||
Permission is hereby granted, free of charge, to any person obtaining a copy | ||
of this software and associated documentation files (the "Software"), to deal | ||
in the Software without restriction, including without limitation the rights | ||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | ||
copies of the Software, and to permit persons to whom the Software is | ||
furnished to do so, subject to the following conditions: | ||
|
||
The above copyright notice and this permission notice shall be included in all | ||
copies or substantial portions of the Software. | ||
|
||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE | ||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | ||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, | ||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE | ||
SOFTWARE. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,60 @@ | ||
# PHP Crypter | ||
Secure the data of your websites by encrypting them. They will be decrypted only in your applications with your secret key | ||
|
||
# How to install ? | ||
|
||
## With composer | ||
|
||
* Firstly you need composer | ||
* Run the command `composer require claudye/php-crypter` | ||
|
||
## Clone or download from github | ||
* Clone or download from [github](https://github.com/Claudye/php-crypter) | ||
* Be sure you have [composer](https://getcomposer.org/) installed | ||
* Goto the root of your project and open there a shell (terminal) | ||
* Run `composer install` | ||
|
||
# Usage | ||
When php crypter is successful installed, please import the Encryption class like : | ||
|
||
`use PHPCrypter\Encryption\Encryption;` | ||
|
||
* To encrypt a data, you use `Encryption::encrypt(string $text, string $algo_method="AES-128-CBC", string $token=null)` | ||
This method requires the data to be encrypted, other arguments are optional. It returns encrypted data that you can store or write somewhere for reuse | ||
* To decrypt the encrypted information later you can use the method | ||
`Encryption::decrypt(string $data_encrypted)` | ||
This method will use the generated key for you to decrypt the data which was encrypted. This key must be secret | ||
|
||
# Example | ||
<pre> | ||
<code> | ||
|
||
use PHPCrypter\Encryption\Encryption; | ||
//You can define your key any where you want | ||
|
||
//define("ENC_TOKEN_PATH", "your/dir/example"); | ||
|
||
require 'vendor/autoload.php'; | ||
// Encrypt the text "The only limit of a developer is his imagination" <br> <br> | ||
$encrypt = Encryption::encrypt("The only limit of a developer is his imagination"); | ||
|
||
//You store the encrypted data in a file or in a database, or any where you can reuse it <br> | ||
//After you want to use it again on your site <br> | ||
//Get your text: $encrypt and then decrypt it <br> | ||
$decrypt = Encryption::decrypt($encrypt); | ||
|
||
//All right ! <br> | ||
|
||
</code> | ||
</pre> | ||
|
||
# Change encryption key path! | ||
|
||
It is possible to change the encryption key path (file or directory) where you want to store the secret key! It's a good idea to choose a very secure path | ||
|
||
# Information | ||
The encryption method used by default is : AES-128-CBC | ||
[Find all the methods here](https://www.php.net/manual/fr/function.openssl-get-cipher-methods.php) | ||
|
||
### Attention! | ||
**When your data is encrypted with a key, only this key can decrypt it, so be careful not to lose your keys or change your keys carelessly.** |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
{ | ||
"name": "claudye/php-crypter", | ||
"description": "Secure the data of your websites by encrypting them. They will be decrypted only in your applications with your secret key", | ||
"type": "library", | ||
"homepage": "https://github.com/Claudye/php-crypter", | ||
"require": { | ||
"php": ">=7.3 || 8.2" | ||
}, | ||
"require-dev": { | ||
"phpunit/phpunit": "^9" | ||
}, | ||
"license": "MIT", | ||
"autoload": { | ||
"psr-4": { | ||
"PHPCrypter\\": "src/" | ||
} | ||
}, | ||
"authors": [ | ||
{ | ||
"name": "Claudye", | ||
"email": "dev.claudy@gmail.com" | ||
} | ||
] | ||
} |
Oops, something went wrong.