Zen API

- Home
- Topics
- Types
- Files

All Classes Files Functions Variables Typedefs Friends Macros Modules Pages
kCipher.h
Go to the documentation of this file.
1
10 #ifndef K_API_CIPHER_H
11 #define K_API_CIPHER_H
12
13 #include <kApi/kApiDef.h>
14
21 //typedef kObject kCipher; --forward-declared in kFsDef.x.h
22
29 typedef k32s kCipherPadding;
30
32 #define kCIPHER_PADDING_NULL (0x0000)
33 #define kCIPHER_PADDING_ANSIX923 (0x0001)
34 #define kCIPHER_PADDING_ISO10126 (0x0002)
35 #define kCIPHER_PADDING_NONE (0x0004)
36 #define kCIPHER_PADDING_PKCS7 (0x0008)
37 #define kCIPHER_PADDING_ZERO (0x0010)
38
46 typedef k32s kCipherMode;
47
49 #define kCIPHER_CIPHER_NULL (0x0000)
50 #define kCIPHER_CIPHER_ECB (0x0001)
51
54 //include class definition
55 #include <kApi/Crypto/kCipher.x.h>
56
71 kInlineFx(kStatus) kCipher_Encrypt(kCipher cipher, const void* data, kSize dataLength, kArray1 result)
72 {
73 return xkCipher_VTable(cipher)->VEncrypt(cipher, data, dataLength, result);
74 }
75
90 kInlineFx(kStatus) kCipher_Decrypt(kCipher cipher, const void* data, kSize dataLength, kArray1 result)
91 {
92 return xkCipher_VTable(cipher)->VDecrypt(cipher, data, dataLength, result);
93 }
94
102 kInlineFx(kCipherPadding) kCipher_Padding(kCipher cipher)
103 {
104 kObj(kCipher, cipher);
105
106 return obj->padding;
107 }
108
116 kInlineFx(kCipherMode) kCipher_Mode(kCipher cipher)
117 {
118 kObj(kCipher, cipher);
119
120 return obj->mode;
121 }
122
130 kInlineFx(kSize) kCipher_Blocksize(kCipher cipher)
131 {
132 return xkCipher_VTable(cipher)->VBlocksize(cipher);
133 }
134
135 #endif
kArray1
Represents a 1D array.
kCipher
Abstract base class for symmetric-key encryption classes.
kCipherPadding
Represents padding mode for encryption.
kCipher::kCipher_Encrypt
kStatus kCipher_Encrypt(kCipher cipher, const void *data, kSize dataLength, kArray1 result)
Encrypts data.
Definition: kCipher.h:71
kCipher::kCipher_Mode
kCipherMode kCipher_Mode(kCipher cipher)
Gets the cipher mode.
Definition: kCipher.h:116
kSize
Represents an unsigned integer that can store a pointer address.
kInlineFx
#define kInlineFx(TYPE)
Inline method declaration helper.
Definition: kApiDef.h:26
kCipher::kCipher_Decrypt
kStatus kCipher_Decrypt(kCipher cipher, const void *data, kSize dataLength, kArray1 result)
Decrypts data.
Definition: kCipher.h:90
kObj
#define kObj(TypeName_T, T_object)
Declares a local "obj" (this-pointer) variable and initializes it from a type-checked object handle...
Definition: kApiDef.h:2892
kApiDef.h
Core Zen type declarations.
k32s
Represents a 32-bit signed integer.
kCipher::kCipher_Padding
kCipherPadding kCipher_Padding(kCipher cipher)
Gets the pattern mode.
Definition: kCipher.h:102
kCipher::kCipher_Blocksize
kSize kCipher_Blocksize(kCipher cipher)
Gets the block size.
Definition: kCipher.h:130
kStatus
Represents an error code.
kCipherMode
Represents cipher mode for encryption and decryption functions.