WA-SDK  3.0.4.0
WA-SDK
issacapi_se.h
이 파일의 문서화 페이지로 가기
1 /*
2  Copyright (C) 2002 PENTA SECURITY SYSTEMS, INC.
3  All rights reserved
4 
5  THIS IS UNPUBLISHED PROPRIETARY
6  SOURCE CODE OF PENTA SECURITY SYSTEMS, INC.
7 
8  The copyright notice above does not evidence any actual or intended
9  publication of such source code.
10 
11  Filename : issacapi_se.h
12 */
13 
14 #ifndef _issacapi_se_h
15 #define _issacapi_se_h
16 
17 #include "issacapi.h"
18 
23 
25 typedef enum {
28 
29  // 2009.10.22 added
38 
39  // for block-cipher based MAC
43 
45 typedef struct _SECONTEXT {
46  void *key;
47  void *instance;
48  int cipher_id;
49 } SECONTEXT;
50 
59  SECONTEXT *secontext
60 );
61 
67  SECONTEXT *secontext
68 );
69 
81  SECONTEXT *secontext,
82  const void *key,
83  int key_len,
84  const void *iv,
85  int iv_len,
86  int mode,
87  int cipher_id
88 );
89 
97  SECONTEXT *destination_secontext,
98  SECONTEXT *source_secontext
99 );
100 
109  void *ciphertext,
110  int *ciphertext_len,
111  int ciphertext_alloc_len,
112  void *plaintext,
113  int plaintext_len,
114  SECONTEXT *secontext
115 );
116 
125  void *ciphertext,
126  int *ciphertext_len,
127  int ciphertext_alloc_len,
128  void *plaintext,
129  int plaintext_len,
130  SECONTEXT *secontext,
131  int pad_type
132 );
133 
143  void *plaintext,
144  int *plaintext_len,
145  int plaintext_alloc_len,
146  void *ciphertext,
147  int ciphertext_len,
148  SECONTEXT *secontext
149 );
150 
160  void *plaintext,
161  int *plaintext_len,
162  int plaintext_alloc_len,
163  void *ciphertext,
164  int ciphertext_len,
165  SECONTEXT *secontext,
166  int pad_type
167 );
168 
177  const char *ciphertext_file,
178  const char *plaintext_file,
179  SECONTEXT *secontext
180 );
181 
191  const char *plaintext_file,
192  const char *ciphertext_file,
193  SECONTEXT *secontext
194 );
195 
203  const char *ciphertext_file,
204  const char *plaintext_file,
205  SECONTEXT *secontext,
206  int buffer_size
207 );
208 
217  const char *plaintext_file,
218  const char *ciphertext_file,
219  SECONTEXT *secontext,
220  int buffer_size
221 );
222 
231  void *ciphertext,
232  int *ciphertext_len,
233  int ciphertext_alloc_len,
234  void *plaintext,
235  int plaintext_len,
236  void *authdata,
237  int authdata_len,
238  void *iv,
239  int iv_len,
240  int tag_len,
241  SECONTEXT *secontext
242 );
243 
252  void *plaintext,
253  int *plaintext_len,
254  int plaintext_alloc_len,
255  void *ciphertext,
256  int ciphertext_len,
257  void *authdata,
258  int authdata_len,
259  void *iv,
260  int iv_len,
261  int tag_len,
262  SECONTEXT *secontext
263 );
264 
274  void *ciphertext,
275  int *ciphertext_len,
276  int ciphertext_alloc_len,
277  void *plaintext,
278  int plaintext_len,
279  SECONTEXT *secontext
280 );
281 
291  void *plaintext,
292  int *plaintext_len,
293  int plaintext_alloc_len,
294  void *ciphertext,
295  int ciphertext_len,
296  SECONTEXT *secontext
297 );
298 
307  void *buf,
308  int buflen
309 );
310 
319  void *keyOut,
320  int keyLen,
321  const char *passwd
322 );
323 
333  void *keyOut,
334  int keyLen,
335  int idByte,
336  const char *passwd,
337  const char *salt,
338  int saltLen,
339  int iterations,
340  int hashType
341 );
342 
352  void *keyOut,
353  int keyLen,
354  const char *passwd,
355  const char *salt,
356  int saltLen,
357  int iterations,
358  int hashType
359 );
360 
361 /***************/
362 
363 #ifdef ISSACAPI_SE_TEST
364 
365 #include <assert.h>
366 #include <stdio.h>
367 #include <stdlib.h>
368 
369 void
370 print_byte_of_len(const unsigned char *buf, int len) {
371  int i;
372  for (i = 0; i < len; ++i) {
373  printf("%02x", buf[i] & 0xff);
374  }
375  printf("\n");
376 }
377 
378 int main() {
379  int ret;
380 
381  unsigned char key[1024];
382 
383  printf("PKCS#12 PBE : ");
384  ret = ISSAC_SE_PBKDF_PKCS12_GetKey(key, 20, "test");
385  assert(ret == 0);
386  print_byte_of_len(key, 20);
387 
388  printf("PKCS#12 PBE : ");
389  ret = ISSAC_SE_PBKDF_PKCS12_GetKey(key, 20, "test");
390  assert(ret == 0);
391  print_byte_of_len(key, 20);
392 
393  printf("PKCS#12 PBE : ");
394  ret = ISSAC_SE_PBKDF_PKCS12_GetKey(key, 21, "test");
395  assert(ret == 0);
396  print_byte_of_len(key, 21);
397 
398  printf("SHARE PKCS#12 PBE : ");
399  ret = ISSAC_SE_PBKDF_PKCS12_GetKey_Advanced(key, 20, 1, "test", "", "8", 2000, 0);
400  assert(ret == 0);
401  print_byte_of_len(key, 20);
402 
403  return 0;
404 }
405 
406 #endif
407 
409 
410 #endif /* _issacapi_se.h */
unsigned int ISSAC_RETURN
ISSAC-API 실행 결과 [ ISSACAPI_BASIC_RETURN, ISSACAPI_ERRORS, ISSAC_LICENSE_ERR ]
Definition: issacapi_bs_definitions.h:32
WA_SDK_API ISSAC_RETURN FUNCCALL ISSAC_SE_Encrypt(void *ciphertext, int *ciphertext_len, int ciphertext_alloc_len, void *plaintext, int plaintext_len, SECONTEXT *secontext)
평문을 암호화한다.
WA_SDK_API ISSAC_RETURN FUNCCALL ISSAC_SE_PBKDF2_GetKey(void *keyOut, int keyLen, const char *passwd, const char *salt, int saltLen, int iterations, int hashType)
입력된 값들을 기반으로 키를 생성(유도)한다. (PKCS#5 - PBKDF2)
WA_SDK_API ISSAC_RETURN FUNCCALL ISSAC_SE_Decrypt(void *plaintext, int *plaintext_len, int plaintext_alloc_len, void *ciphertext, int ciphertext_len, SECONTEXT *secontext)
암호문을 복호화한다.
WA_SDK_API ISSAC_RETURN FUNCCALL ISSAC_SE_Decrypt_Auth(void *plaintext, int *plaintext_len, int plaintext_alloc_len, void *ciphertext, int ciphertext_len, void *authdata, int authdata_len, void *iv, int iv_len, int tag_len, SECONTEXT *secontext)
입력한 암호문을 CCM/GCM 방식으로 복호화한다.
WA_SDK_API ISSAC_RETURN FUNCCALL ISSAC_SECONTEXT_Create(SECONTEXT *secontext)
SECONTEXT 구조체를 초기화한다.
WA_SDK_API ISSAC_RETURN FUNCCALL ISSAC_SE_Encrypt_CMS(void *ciphertext, int *ciphertext_len, int ciphertext_alloc_len, void *plaintext, int plaintext_len, SECONTEXT *secontext)
PKCS #7 - EnvelopedData 메시지 형식으로 암호화한다.
WA_SDK_API ISSAC_RETURN FUNCCALL ISSAC_SECONTEXT_Copy(SECONTEXT *destination_secontext, SECONTEXT *source_secontext)
SECONTEXT 를 복사한다.
WA_SDK_API ISSAC_RETURN FUNCCALL ISSAC_SE_Encrypt_File(const char *ciphertext_file, const char *plaintext_file, SECONTEXT *secontext)
입력한 파일을 암호화한다.
WA_SDK_API ISSAC_RETURN FUNCCALL ISSAC_SECONTEXT_Delete(SECONTEXT *secontext)
SECONTEXT 에 할당된 메모리를 해제한다.
WA_SDK_API ISSAC_RETURN FUNCCALL ISSAC_SE_Encrypt_File_BSize(const char *ciphertext_file, const char *plaintext_file, SECONTEXT *secontext, int buffer_size)
입력한 파일을 암호화한다. (입력한 버퍼크기 사용)
WA_SDK_API ISSAC_RETURN FUNCCALL ISSAC_SECONTEXT_Set(SECONTEXT *secontext, const void *key, int key_len, const void *iv, int iv_len, int mode, int cipher_id)
SECONTEXT 에 암호화를 위한 정보들을 입력한다.
WA_SDK_API ISSAC_RETURN FUNCCALL ISSAC_SE_Decrypt_File(const char *plaintext_file, const char *ciphertext_file, SECONTEXT *secontext)
입력한 파일을 복호화한다.
WA_SDK_API ISSAC_RETURN FUNCCALL ISSAC_SE_DecryptEx(void *plaintext, int *plaintext_len, int plaintext_alloc_len, void *ciphertext, int ciphertext_len, SECONTEXT *secontext, int pad_type)
암호문을 복호화한다.
WA_SDK_API ISSAC_RETURN FUNCCALL ISSAC_SE_PBKDF_PKCS12_GetKey_Advanced(void *keyOut, int keyLen, int idByte, const char *passwd, const char *salt, int saltLen, int iterations, int hashType)
입력된 값들을 기반으로 키를 생성(유도)한다. (PKCS#12 v1.0 Appendix. B)
WA_SDK_API ISSAC_RETURN FUNCCALL ISSAC_SE_Encrypt_Auth(void *ciphertext, int *ciphertext_len, int ciphertext_alloc_len, void *plaintext, int plaintext_len, void *authdata, int authdata_len, void *iv, int iv_len, int tag_len, SECONTEXT *secontext)
입력한 원문을 CCM/GCM 방식으로 암호화한다.
WA_SDK_API ISSAC_RETURN FUNCCALL ISSAC_SE_PBKDF_PKCS12_GetKey(void *keyOut, int keyLen, const char *passwd)
입력된 PIN을 기반으로 암복호화용 키를 생성(유도)한다. (PKCS#12 v1.0 Appendix. B)
WA_SDK_API ISSAC_RETURN FUNCCALL ISSAC_SE_Decrypt_File_BSize(const char *plaintext_file, const char *ciphertext_file, SECONTEXT *secontext, int buffer_size)
입력한 파일을 복호화한다. (입력한 버퍼크기 사용)
ISSACAPI_SE_MODES
대칭키 암호 블록 운용모드
Definition: issacapi_se.h:25
WA_SDK_API ISSAC_RETURN FUNCCALL ISSAC_SE_Decrypt_CMS(void *plaintext, int *plaintext_len, int plaintext_alloc_len, void *ciphertext, int ciphertext_len, SECONTEXT *secontext)
PKCS #7 - EnvelopedData 메시지 형식의 암호문을 복호화한다.
WA_SDK_API ISSAC_RETURN FUNCCALL ISSAC_SE_GetRandom(void *buf, int buflen)
랜덤값을 생성한다.
WA_SDK_API ISSAC_RETURN FUNCCALL ISSAC_SE_EncryptEx(void *ciphertext, int *ciphertext_len, int ciphertext_alloc_len, void *plaintext, int plaintext_len, SECONTEXT *secontext, int pad_type)
평문을 암호화한다.
@ ISSACAPI_SE_CTS_MODE
Cipert Text Stealing (출력 크기가 입력 크기와 동일한 패딩 방법을 사용하는 CBC)
Definition: issacapi_se.h:34
@ ISSACAPI_SE_OFB_BYTE_MODE
Output Feedback 에서 암호화 한 블럭의 상위 j-bits 가 1 바이트 일 때
Definition: issacapi_se.h:33
@ ISSACAPI_SE_OFB_MODE
Output Feedback
Definition: issacapi_se.h:32
@ ISSACAPI_SE_CBC_MODE
Cipher Block Chaining
Definition: issacapi_se.h:27
@ ISSACAPI_SE_GCM_MODE
Galois/Counter Mode of Operation
Definition: issacapi_se.h:40
@ ISSACAPI_SE_CCM_MODE
Counter Mode With CBC-MAC
Definition: issacapi_se.h:41
@ ISSACAPI_SE_CFB1_MODE
Cipher Feedback with bit feedback
Definition: issacapi_se.h:35
@ ISSACAPI_SE_ECB_MODE
Electronic Codebook
Definition: issacapi_se.h:26
@ ISSACAPI_SE_CTR_MODE
Counter Mode
Definition: issacapi_se.h:36
@ ISSACAPI_SE_MCFB_MODE
Cipher Feedback with variable-sized message input.
Definition: issacapi_se.h:37
@ ISSACAPI_SE_CFB_BYTE_MODE
Cipher Feedback 에서 암호화 한 블럭의 상위 j-bits 가 1 바이트 일 때
Definition: issacapi_se.h:31
@ ISSACAPI_SE_CFB_MODE
Cipher Feedback
Definition: issacapi_se.h:30
대칭키 암호화 컨텍스트
Definition: issacapi_se.h:45
void * instance
Definition: issacapi_se.h:47
void * key
Definition: issacapi_se.h:46
int cipher_id
Definition: issacapi_se.h:48
#define FUNCCALL
Definition: wasdk_public.h:9
#define WA_SDK_API
Definition: wasdk_public.h:27