WA-SDK  3.0.4.0
WA-SDK
KeyManage.h
이 파일의 문서화 페이지로 가기
1 #ifndef __CKEYMANAGEMENT_H_
2 #define __CKEYMANAGEMENT_H_
3 
4 #include "wasdk_public.h"
5 
6 #ifdef WIN32
7 // #include "stdafx.h"
8 # include <windows.h>
9 #else
10 # include <stdarg.h>
11 #ifdef SUPPORT_SHARED_MEMORY
12 # include <sys/ipc.h>
13 # include <sys/shm.h>
14 #endif
15 #endif
16 
17 #include "asn1.h"
18 #include "ckm_pkcrypt.h"
19 #include "bcipher_op.h"
20 #include "seed.h"
21 #include "base64.h"
22 #include "piex.h"
23 
24 // PrivateKey파일은 메모리에 SEED로 암호화된후 저장되어 있다
25 // 제품키를 이용해서 SEED로 복호화 해준다
26 // Note(jyha) : not used but defined in header (cannot remove)
27 // coverity[declared_but_not_referenced]
28 const static unsigned char symmetricKey_[16] = {
29  0x4d, 0x65, 0x12, 0x3b, 0x55, 0xdd, 0xc9, 0x4f,
30  0xb8, 0xa8, 0xa1, 0xd5, 0x44, 0xb2, 0xb9, 0xf7
31 };
32 
33 // coverity[declared_but_not_referenced]
34 const static unsigned char iv_[16] = {
35  0xa2, 0xc5, 0x4d, 0x6c, 0xfa, 0x2a, 0x59, 0x58,
36  0x47, 0xf3, 0xc4, 0xa5, 0x34, 0x03, 0x14, 0x71
37 };
38 
39 #define SHARED_MEMORY_NAME_FOR_PRIVATEKEY "ISSAC-WEB PRIVATE KEY"
40 #define ISSACWEB_SHARED_MEM_SIZE 2048
41 
42 #define RANDOM_SEED_SIZE 2048
43 
44 //
45 #define MAX_ASN1_PRIVATEKEYINFO_LENGTH 1024
46 #define MAX_BASE64ENCODED_ASN1_PRIVATEKEYINFO_LENGTH 1024
47 #define MAX_SEEDENCRYPTED_BASE64ENCODED_ASN1_PRIVATEKEYINFO_LENGTH 2048
48 
49 // PrivateKey를 SharedMemory에서 로드할것인지 KeyFile에서 로드할것인지를 configure파일에서 읽어들여서 판별한다
50 EXTERNC int
52 
53 // PrivateKeyInfo, PrivateKey를 XOR해서 저장하는데, 이때 XOR에 사용할 RANDOM SEED를 생성한다
54 EXTERNC int
55 GetRandomSeed(unsigned char* pszRandomSeed);
56 
57 // PrivateKeyInfo를 SHARED Memory에서 로드하는 함수
58 EXTERNC int
60 
61 // PrivateKeyInfo를 Key파일에서 로드하는 함수
62 EXTERNC int
63 PrivateKeyInfoLoadFromKeyFile(const char *pszPrivateKeyPath);
64 
65 // PrivateKey를 PrivateKeyInfo에서 로드하는 함수
66 EXTERNC int
67 PrivateKeyLoadFromPrivateKeyInfo(const char *pszPrivateKeyPath);
68 
69 EXTERNC int
71 
72 // PrivateKey를 얻어오는 함수
73 EXTERNC int
74 GetPrivateKey(unsigned char* pszPrivateKey, const char *pszPrivateKeyPath);
75 
76 // PrivateKeyInfo를 얻어오는 함수
77 EXTERNC int
78 GetPrivateKeyInfo(PrivateKeyInfo** asnPrivateKeyInfo, const char *pszPrivateKeyPath);
79 
80 EXTERNC void
81 LogFileEx(const char *srcFileName, const int srcLine, const char *logFileName, char *fmt, ...);
82 
83 #endif
EXTERNC int GetPrivateKeyLoadType()
EXTERNC int PrivateKeyInfoLoadFromKeyFile(const char *pszPrivateKeyPath)
EXTERNC int GetPrivateKey(unsigned char *pszPrivateKey, const char *pszPrivateKeyPath)
EXTERNC int GetRandomSeed(unsigned char *pszRandomSeed)
EXTERNC int GetPrivateKeyInfo(PrivateKeyInfo **asnPrivateKeyInfo, const char *pszPrivateKeyPath)
EXTERNC void LogFileEx(const char *srcFileName, const int srcLine, const char *logFileName, char *fmt,...)
EXTERNC int TestFuncCall()
EXTERNC int PrivateKeyLoadFromPrivateKeyInfo(const char *pszPrivateKeyPath)
EXTERNC int PrivateKeyInfoLoadFromSharedMemory()
#define EXTERNC
Definition: wasdk_public.h:16