# cipher.h

Go to the documentation of this file.

    00001 /*
    00002   Copyright 1999-2008 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 _WIZARDS_TOOLKIT_CIPHER_H
    00019 #define _WIZARDS_TOOLKIT_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   CTRMode
    00034 } CipherMode;
    00035
    00036 typedef enum
    00037 {
    00038   UndefinedCipher,
    00039   NoCipher,
    00040   AESCipher,
    00041   SerpentCipher,
    00042   TwofishCipher
    00043 } CipherType;
    00044
    00045 typedef struct _CipherInfo
    00046   CipherInfo;
    00047
    00048 extern WizardExport CipherInfo
    00049   *AcquireCipherInfo(const CipherType,const CipherMode),
    00050   *DestroyCipherInfo(CipherInfo *);
    00051
    00052 extern WizardExport const StringInfo
    00053   *GetCipherNonce(CipherInfo *);
    00054
    00055 extern WizardExport StringInfo
    00056   *DecryptCipher(CipherInfo *,StringInfo *),
    00057   *EncryptCipher(CipherInfo *,StringInfo *),
    00058   *GenerateCipherNonce(CipherInfo *);
    00059
    00060 extern WizardExport unsigned long
    00061   GetCipherBlocksize(const CipherInfo *);
    00062
    00063 extern WizardExport void
    00064   ResetCipherNonce(CipherInfo *),
    00065   SetCipherNonce(CipherInfo *,const StringInfo *),
    00066   SetCipherKey(CipherInfo *,const StringInfo *);
    00067
    00068 #if defined(__cplusplus) || defined(c_plusplus)
    00069 }
    00070 #endif
    00071
    00072 #endif