GithubHelp home page GithubHelp logo

jgkim7 / lib_mysqludf_aes256 Goto Github PK

View Code? Open in Web Editor NEW

This project forked from joungkyun/lib_mysqludf_aes256

0.0 1.0 0.0 588 KB

Support AES-256 encrypt and decrypt functions on mysql and mariadb

License: GNU General Public License v2.0

Makefile 11.71% C 17.78% Shell 68.80% M4 1.71%

lib_mysqludf_aes256's Introduction

lib_mysqludf_aes256

Build Status GitHub license

Support AES 128/192/256 encrypt and decrypt on MySQL and Maraidb with User Defined Function.

License

Copyright (c) 2016 JoungKyun.Kim <http://oops.org> All rights reserved. This program is under GPL v2

Requirements

MySQL <= 5.7
Mariadb <= 10.2

From the version MySQL 5.6.17 and later, you can encode to AES-256 with AES_ENCRYPT function using the block_encryption_mode global variable. see also http://mysqlblog.fivefarmers.com/2014/03/27/mysql-5-6-17-now-with-better-encryption/. And from version 5.7.4 and later, you can encode to AES-256 with AES_ENCRYPT using 32byte key lentgh. MariaDB does not yet support thie features.

Usage

  • AES 128 encrypt and decrypt
    • key length : 16byte
    • If the length of the key is 16byte, AES256_ENCRYPT will operate in the same way as AES_ENCRYPT.
mysql> select HEX(AES256_ENCRYPT('strings', '0123456789abcdef'));
mysql> select AES256_DECRYPT(UNHEX('encrypted_hash_string'), '0123456789abcdef');
  • AES 192 encrypt and decrypt
    • key length : 24byte
mysql> select HEX(AES256_ENCRYPT('strings', '0123456789abcdef01234567'));
mysql> select AES256_DECRYPT(UNHEX('encrypted_hash_string'), '0123456789abcdef01234567');
  • AES 256 encrypt and decrypt
    • key length : 32byte
mysql> select HEX(AES256_ENCRYPT('strings', '0123456789abcdef0123456789abcdef'));
mysql> select AES256_DECRYPT(UNHEX('encrypted_hash_string'), '0123456789abcdef0123456789abcdef');

Installation

  • Build and installation
[root@host lib_mysqludf_aes256]$ ./configure \
        --with-mysql=@MYSQL_PREFIX@ \
        --with-mysql-config=/usr/bin/mysql_config
[root@host lib_mysqludf_aes256]$ make
[root@host lib_mysqludf_aes256]$ make install

Before 1.0.4, you must use --with-mysql-plugins-dir instead of --with-mysql-config options.

[root@host lib_mysqludf_aes256]$ ./configure \
        --with-mysql=@MYSQL_PREFIX@ \
        --with-mysql-plugins-dir="$(mysql_config --plugindir)"

If you want to check installed files, you can test install as follow.

[root@host lib_mysqludf_aes256]$ make test-install
[root@host lib_mysqludf_aes256]$ # OR
[root@host lib_mysqludf_aes256]$ make install DESTDIR=$(pwd)/z
[root@host lib_mysqludf_aes256]$ # chcek test-install files
[root@host lib_mysqludf_aes256]$ tree z # or find ./z
  • Regist AES256_ENCRYPT/AES256_DECRYPT UDF
[root@host lib_mysqludf_aes256]$ mysql < doc/aes256_install.sql
  • Unregist AES256_ENCRYPT/AES256_DECRYPT UDF
[root@host lib_mysqludf_aes256]$ mysql < doc/aes256_uninstall.sql

After installation, aes256_install.sql and aes256_uninstall.sql are located in PREFIX/share/doc/lib_mysqludf_aes256-@VERSION@/.

Language API

This UDF function will operate in the same way with follow apis:

Credits

JoungKyun.Kim

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.