|
WizardsToolkit
1.0.7
|
00001 /* 00002 Copyright 1999-2011 ImageMagick Studio LLC, a non-profit organization 00003 dedicated to making software imaging solutions freely available. 00004 00005 You may not use this file except in compliance with the License. 00006 obtain a copy of the License at 00007 00008 http://www.wizards-toolkit.org/script/license.php 00009 00010 Unless required by applicable law or agreed to in writing, software 00011 distributed under the License is distributed on an "AS IS" BASIS, 00012 WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 00013 See the License for the specific language governing permissions and 00014 limitations under the License. 00015 00016 Wizard's Toolkit secure cipher algorithm methods. 00017 */ 00018 #ifndef _WIZARDSTOOLKIT_CIPHER_H 00019 #define _WIZARDSTOOLKIT_CIPHER_H 00020 00021 #if defined(__cplusplus) || defined(c_plusplus) 00022 extern "C" { 00023 #endif 00024 00025 #include "wizard/random_.h" 00026 00027 #define MaxCipherBlocksize 128 00028 00029 typedef enum 00030 { 00031 UndefinedMode, 00032 CBCMode, 00033 CFBMode, 00034 CTRMode, 00035 ECBMode, 00036 OFBMode 00037 } CipherMode; 00038 00039 typedef enum 00040 { 00041 UndefinedCipher, 00042 NoCipher, 00043 AESCipher, 00044 SerpentCipher, 00045 TwofishCipher 00046 } CipherType; 00047 00048 typedef struct _CipherInfo 00049 CipherInfo; 00050 00051 extern WizardExport CipherInfo 00052 *AcquireCipherInfo(const CipherType,const CipherMode), 00053 *DestroyCipherInfo(CipherInfo *); 00054 00055 extern WizardExport const StringInfo 00056 *GetCipherNonce(CipherInfo *); 00057 00058 extern WizardExport StringInfo 00059 *DecipherCipher(CipherInfo *,StringInfo *), 00060 *EncipherCipher(CipherInfo *,StringInfo *), 00061 *GenerateCipherNonce(CipherInfo *); 00062 00063 extern WizardExport size_t 00064 GetCipherBlocksize(const CipherInfo *); 00065 00066 extern WizardExport void 00067 ResetCipherNonce(CipherInfo *), 00068 SetCipherNonce(CipherInfo *,const StringInfo *), 00069 SetCipherKey(CipherInfo *,const StringInfo *); 00070 00071 /* 00072 Deprecated methods. 00073 */ 00074 extern WizardExport StringInfo 00075 *DecryptCipher(CipherInfo *,StringInfo *), 00076 *EncryptCipher(CipherInfo *,StringInfo *); 00077 00078 #if defined(__cplusplus) || defined(c_plusplus) 00079 } 00080 #endif 00081 00082 #endif