Download the PHP package soliphp/aes without Composer

On this page you can find all versions of the php package soliphp/aes. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.

FAQ

After the download, you have to make one include require_once('vendor/autoload.php');. After that you have to import the classes with use statements.

Example:
If you use only one package a project is not needed. But if you use more then one package, without a project it is not possible to import the classes with use statements.

In general, it is recommended to use always a project to download your libraries. In an application normally there is more than one library needed.
Some PHP packages are not free to download and because of that hosted in private repositories. In this case some credentials are needed to access such packages. Please use the auth.json textarea to insert credentials, if a package is coming from a private repository. You can look here for more information.

  • Some hosting areas are not accessible by a terminal or SSH. Then it is not possible to use Composer.
  • To use Composer is sometimes complicated. Especially for beginners.
  • Composer needs much resources. Sometimes they are not available on a simple webspace.
  • If you are using private repositories you don't need to share your credentials. You can set up everything on our site and then you provide a simple download link to your team member.
  • Simplify your Composer build process. Use our own command line tool to download the vendor folder as binary. This makes your build process faster and you don't need to expose your credentials for private repositories.
Please rate this library. Is it a good library?

Informations about the package aes

Soli OpenSSL Aes

基于 OpenSSL 扩展的 AES 加解密库。

Build Status Coverage Status License

安装

使用 composer 进行安装:

composer require soliphp/aes

使用

include __DIR__ . '/vendor/autoload.php';

$aes = new \Soli\Aes();

$data = 'hello world.';
$secret = 'your_secret';

$encrypted = $aes->encrypt($data, $secret);

$decrypted = $aes->decrypt($encrypted, $secret);

var_dump($decrypted);

加密数据

$aes = new \Soli\Aes();

$encrypted = $aes->encrypt('hello world.', 'your_secret');

解密数据

$aes = new \Soli\Aes();

$decrypted = $aes->decrypt('U2FsdGVkX1/mgtCqMAn6S9AKVrqjPn8NoJkysV5JPII=', 'your_secret');

256/192/128

默认使用 AES-256-CBC

$aes = new \Soli\Aes();
// 等同于
$aes = new \Soli\Aes(256);

使用 AES-192-CBC

$aes = new \Soli\Aes(192);

使用 AES-128-CBC

$aes = new \Soli\Aes(128);

使用 OpenSSL 命令行加解密

加密数据:

$ echo -n 'hello world.' | openssl aes-256-cbc -md md5 -base64 -pass pass:your_secret
U2FsdGVkX1/mgtCqMAn6S9AKVrqjPn8NoJkysV5JPII=

解密数据:

$ echo 'U2FsdGVkX1/mgtCqMAn6S9AKVrqjPn8NoJkysV5JPII=' | openssl aes-256-cbc -md md5 -d -base64 -pass pass:your_secret

注:如果命令行下加密的数据含有特殊字符,导致无法加密,使用单引号包裹,如:

$ echo -n 'hello ~!@%^&*()\{}[]/?' | openssl aes-256-cbc -md md5 -base64 -pass pass:'~!@%^&*()\{}[]/?'

md5/sha256 信息摘要算法

摘自 OpenSSL sha256 HISTORY

The default digest was changed from MD5 to SHA256 in OpenSSL 1.1.0 The FIPS-related options were removed in OpenSSL 1.1.0
在 OpenSSL 1.1.0 版本中,默认信息摘要算法从 MD5 更改为 SHA256

所以在使用 OpenSSL 命令行加解密数据时务必显示指定 -md md5 参数, 以便在 OpenSSL 1.0 和 1.1 版本下执行命令时都可成功加解密。

当前项目目前只支持 md5 方式。

参考

https://github.com/chmduquesne/minibackup/blob/master/samples/OpensslAES.java

测试

$ cd /path/to/soliphp/aes/
$ composer install
$ phpunit

MIT License

MIT Public License


All versions of aes with dependencies

PHP Build Version
Package Version
Requires php Version >=5.5.0
ext-openssl Version *
Composer command for our command line client (download client) This client runs in each environment. You don't need a specific PHP version etc. The first 20 API calls are free. Standard composer command

The package soliphp/aes contains the following files

Loading the files please wait ....