/External/Mysql-5.0/include/my_aes.h

http://awoe.googlecode.com/ · C++ Header · 65 lines · 9 code · 13 blank · 43 comment · 0 complexity · 1c73913fa8492d5e9d035dadc72eba2a MD5 · raw file

  1. /* Copyright (C) 2002 MySQL AB
  2. This program is free software; you can redistribute it and/or modify
  3. it under the terms of the GNU General Public License as published by
  4. the Free Software Foundation; version 2 of the License.
  5. This program is distributed in the hope that it will be useful,
  6. but WITHOUT ANY WARRANTY; without even the implied warranty of
  7. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  8. GNU General Public License for more details.
  9. You should have received a copy of the GNU General Public License
  10. along with this program; if not, write to the Free Software
  11. Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
  12. /* Header file for my_aes.c */
  13. /* Wrapper to give simple interface for MySQL to AES standard encryption */
  14. #include "mysys/rijndael.h"
  15. C_MODE_START
  16. #define AES_KEY_LENGTH 128 /* Must be 128 192 or 256 */
  17. /*
  18. my_aes_encrypt - Crypt buffer with AES encryption algorithm.
  19. source - Pointer to data for encryption
  20. source_length - size of encryption data
  21. dest - buffer to place encrypted data (must be large enough)
  22. key - Key to be used for encryption
  23. kel_length - Length of the key. Will handle keys of any length
  24. returns - size of encrypted data, or negative in case of error.
  25. */
  26. int my_aes_encrypt(const char *source, int source_length, char *dest,
  27. const char *key, int key_length);
  28. /*
  29. my_aes_decrypt - DeCrypt buffer with AES encryption algorithm.
  30. source - Pointer to data for decryption
  31. source_length - size of encrypted data
  32. dest - buffer to place decrypted data (must be large enough)
  33. key - Key to be used for decryption
  34. kel_length - Length of the key. Will handle keys of any length
  35. returns - size of original data, or negative in case of error.
  36. */
  37. int my_aes_decrypt(const char *source, int source_length, char *dest,
  38. const char *key, int key_length);
  39. /*
  40. my_aes_get_size - get size of buffer which will be large enough for encrypted
  41. data
  42. source_length - length of data to be encrypted
  43. returns - size of buffer required to store encrypted data
  44. */
  45. int my_aes_get_size(int source_length);
  46. C_MODE_END