00001 00005 #ifndef _CYFER_KEYEX_H_ 00006 #define _CYFER_KEYEX_H_ 00007 00008 #define CYFER_KEYEX_NONE 0 00009 #define CYFER_KEYEX_DH 1 00010 00011 #ifdef CYFER_INTERNAL 00012 #include <dh.h> 00013 00014 typedef struct { 00015 int type; 00016 union { 00017 DH_CTX dh; 00018 } u; 00019 } CYFER_KEYEX_CTX; 00020 #else 00021 #include <cyfer/cyfer.h> 00023 typedef void CYFER_KEYEX_CTX; 00024 #endif 00025 00027 typedef struct { 00029 int type; 00031 char *name; 00032 } CYFER_KeyEx_t; 00033 00034 #ifdef __cplusplus 00035 extern "C" { 00036 #endif 00037 00039 CYFER_API CYFER_KeyEx_t *CYFER_KeyEx_Get_Supported(void); 00040 00044 CYFER_API int CYFER_KeyEx_Select(const char *name); 00045 00049 CYFER_API CYFER_KEYEX_CTX *CYFER_KeyEx_Init(int type); 00050 00053 CYFER_API void CYFER_KeyEx_Finish(CYFER_KEYEX_CTX *ctx); 00054 00057 CYFER_API void CYFER_KeyEx_Generate_Key(CYFER_KEYEX_CTX *ctx); 00058 00063 CYFER_API void CYFER_KeyEx_KeySize(CYFER_KEYEX_CTX *ctx, size_t *privlen, size_t *publen); 00064 00070 CYFER_API bool CYFER_KeyEx_Compute_Key(CYFER_KEYEX_CTX *ctx, unsigned char *other, size_t len); 00071 00075 CYFER_API void CYFER_KeyEx_Public_Key(CYFER_KEYEX_CTX *ctx, unsigned char *key); 00076 00082 CYFER_API void CYFER_KeyEx_Shared_Key(CYFER_KEYEX_CTX *ctx, unsigned char *key, size_t len); 00083 00084 #ifdef __cplusplus 00085 }; 00086 #endif 00087 00088 #endif /* _CYFER_KEYEX_H_ */ 00089
1.3-rc3