root/WizardsToolkit/trunk/wizard/cipher.h

Revision 256, 1.9 KB (checked in by cristy, 8 weeks ago)
Line 
1/*
2  Copyright 1999-2009 ImageMagick Studio LLC, a non-profit organization
3  dedicated to making software imaging solutions freely available.
4
5  You may not use this file except in compliance with the License.
6  obtain a copy of the License at
7
8    http://www.wizards-toolkit.org/script/license.php
9
10  Unless required by applicable law or agreed to in writing, software
11  distributed under the License is distributed on an "AS IS" BASIS,
12  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  See the License for the specific language governing permissions and
14  limitations under the License.
15
16  Wizard's Toolkit secure cipher algorithm methods.
17*/
18#ifndef _WIZARDSTOOLKIT_CIPHER_H
19#define _WIZARDSTOOLKIT_CIPHER_H
20
21#if defined(__cplusplus) || defined(c_plusplus)
22extern "C" {
23#endif
24
25#include "wizard/random_.h"
26
27#define MaxCipherBlocksize  128
28
29typedef enum
30{
31  UndefinedMode,
32  CBCMode,
33  CFBMode,
34  CTRMode,
35  ECBMode,
36  OFBMode
37} CipherMode;
38
39typedef enum
40{
41  UndefinedCipher,
42  NoCipher,
43  AESCipher,
44  SerpentCipher,
45  TwofishCipher
46} CipherType;
47
48typedef struct _CipherInfo
49  CipherInfo;
50
51extern WizardExport CipherInfo
52  *AcquireCipherInfo(const CipherType,const CipherMode),
53  *DestroyCipherInfo(CipherInfo *);
54
55extern WizardExport const StringInfo
56  *GetCipherNonce(CipherInfo *);
57
58extern WizardExport StringInfo
59  *DecipherCipher(CipherInfo *,StringInfo *),
60  *EncipherCipher(CipherInfo *,StringInfo *),
61  *GenerateCipherNonce(CipherInfo *);
62
63extern WizardExport size_t
64  GetCipherBlocksize(const CipherInfo *);
65
66extern WizardExport void
67  ResetCipherNonce(CipherInfo *),
68  SetCipherNonce(CipherInfo *,const StringInfo *),
69  SetCipherKey(CipherInfo *,const StringInfo *);
70
71/*
72  Deprecated methods.
73*/
74extern WizardExport StringInfo
75  *DecryptCipher(CipherInfo *,StringInfo *),
76  *EncryptCipher(CipherInfo *,StringInfo *);
77
78#if defined(__cplusplus) || defined(c_plusplus)
79}
80#endif
81
82#endif
Note: See TracBrowser for help on using the browser.