PHPackages                             joungkyun/mysqlaes - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Security](/categories/security)
4. /
5. joungkyun/mysqlaes

ActiveLibrary[Security](/categories/security)

joungkyun/mysqlaes
==================

Support AES-256 encrypt and decrypt class APIs

2.0.0(8y ago)020BSD-2-ClausePHPPHP &gt;=7.1.0

Since Feb 16Pushed 8y ago1 watchersCompare

[ Source](https://github.com/OOPS-ORG-PHP/mysqlAES)[ Packagist](https://packagist.org/packages/joungkyun/mysqlaes)[ Docs](https://github.com/OOPS-ORG-PHP/mysqlAES)[ RSS](/packages/joungkyun-mysqlaes/feed)WikiDiscussions master Synced 3w ago

READMEChangelog (4)DependenciesVersions (5)Used By (0)

PHP mysqlAES class library
==========================

[](#php-mysqlaes-class-library)

Abstract
--------

[](#abstract)

***mysqlAES*** package supports **AES 128/192/256** encryptioin, and this API is compatible with [lib\_mysqludf\_aes256 MySQL UDF](https://github.com/Joungkyun/lib_mysqludf_aes256) and [mysqlAES javascript API](http://mirror.oops.org/pub/oops/javascript/mysqlAES/).

Also, this api supports hex and unhex API that is compatble with MySQL and MariaDB.

If encrypt with 128bit, this api is operate in the same way with AES\_ENCRYPT and AES\_DECRYPT of MySQL or MariaDB.

License
-------

[](#license)

BSD 2-Clause

Installation
------------

[](#installation)

mysqlAES 2.x works with PHP 7.1 and later. Use mysqlAES-1 branch or 1.x version for use with PHP 7.0 and before. The ***mysqlAES-1*** branch also supports php 7 and later.

mysqlAES package needs follow external libraries.

1. php [openssl](http://php.net/manual/en/book.openssl.php) extension

And, you can install in three ways that are download source files by hands or using pear command or use composer. If you choose to install manually, you will also need to install the required external libraries yourself. Therefore, it is recommended to use the pear command to reduce this effort.

### \* Download source files

[](#-download-source-files)

1. download latest version at [release page](https://github.com/OOPS-ORG-PHP/mysqlAES/releases).
2. uncompress the downloaded package to the desired path.
3. add the path in the ***include\_path*** ini option.
4. include ***mysqlAES.php*** file in your code.

### \* Use pear command

[](#-use-pear-command)

This method is needed root privileges.

```
[root@host ~]$ pear channel-discover pear.oops.org
[root@host ~]$ pear install oops/mysqlAES
[root@host ~]$ pear list -a
```

### \* Use composer

[](#-use-composer)

first, make composer.json as follow:

```
{
    "require": {
        "joungkyun/mysqlaes": "2.*"
    }
}
```

and, install mysqlAES

```
[user@host project]$ php composer.phpt install
Loading composer repositories with package information
Updating dependencies (including require-dev)
Package operations: 1 installs, 0 updates, 0 removals
  - Installing joungkyun/mysqlaes (2.0.0): Downloading (100%)
Writing lock file
Generating autoload files
[user@host project]$
```

and, write code as follow:

```
