Eneboo - Documentación para desarrolladores
|
00001 /* Copyright (C) 2002 MySQL AB 00002 00003 This program is free software; you can redistribute it and/or modify 00004 it under the terms of the GNU General Public License as published by 00005 the Free Software Foundation; version 2 of the License. 00006 00007 This program is distributed in the hope that it will be useful, 00008 but WITHOUT ANY WARRANTY; without even the implied warranty of 00009 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00010 GNU General Public License for more details. 00011 00012 You should have received a copy of the GNU General Public License 00013 along with this program; if not, write to the Free Software 00014 Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ 00015 00016 00017 /* Header file for my_aes.c */ 00018 /* Wrapper to give simple interface for MySQL to AES standard encryption */ 00019 00020 #include "rijndael.h" 00021 00022 C_MODE_START 00023 00024 #define AES_KEY_LENGTH 128 /* Must be 128 192 or 256 */ 00025 00026 /* 00027 my_aes_encrypt - Crypt buffer with AES encryption algorithm. 00028 source - Pointer to data for encryption 00029 source_length - size of encryption data 00030 dest - buffer to place encrypted data (must be large enough) 00031 key - Key to be used for encryption 00032 kel_length - Length of the key. Will handle keys of any length 00033 00034 returns - size of encrypted data, or negative in case of error. 00035 */ 00036 00037 int my_aes_encrypt(const char *source, int source_length, char *dest, 00038 const char *key, int key_length); 00039 00040 /* 00041 my_aes_decrypt - DeCrypt buffer with AES encryption algorithm. 00042 source - Pointer to data for decryption 00043 source_length - size of encrypted data 00044 dest - buffer to place decrypted data (must be large enough) 00045 key - Key to be used for decryption 00046 kel_length - Length of the key. Will handle keys of any length 00047 00048 returns - size of original data, or negative in case of error. 00049 */ 00050 00051 00052 int my_aes_decrypt(const char *source, int source_length, char *dest, 00053 const char *key, int key_length); 00054 00055 /* 00056 my_aes_get_size - get size of buffer which will be large enough for encrypted 00057 data 00058 source_length - length of data to be encrypted 00059 00060 returns - size of buffer required to store encrypted data 00061 */ 00062 00063 int my_aes_get_size(int source_length); 00064 00065 C_MODE_END