API参考
载入中...
搜索中...
未找到
crypt_eal_codecs.h
1/*
2 * This file is part of the openHiTLS project.
3 *
4 * openHiTLS is licensed under the Mulan PSL v2.
5 * You can use this software according to the terms and conditions of the Mulan PSL v2.
6 * You may obtain a copy of Mulan PSL v2 at:
7 *
8 * http://license.coscl.org.cn/MulanPSL2
9 *
10 * THIS SOFTWARE IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND,
11 * EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT,
12 * MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE.
13 * See the Mulan PSL v2 for more details.
14 */
15
21
22#ifndef CRYPT_EAL_CODECS_H
23#define CRYPT_EAL_CODECS_H
24
25#include "bsl_params.h"
26#include "bsl_types.h"
27#include "bsl_list.h"
28#include "crypt_eal_pkey.h"
29#include "crypt_eal_provider.h"
30
31#ifdef __cplusplus
32extern "C" {
33#endif // __cplusplus
34
35typedef struct CRYPT_DecoderCtx CRYPT_DECODER_Ctx;
36
45CRYPT_DECODER_Ctx *CRYPT_DECODE_ProviderNewCtx(CRYPT_EAL_LibCtx *libCtx, int32_t pkeyAlgId, const char *attrName);
46
52void CRYPT_DECODE_Free(CRYPT_DECODER_Ctx *ctx);
53
61int32_t CRYPT_DECODE_SetParam(CRYPT_DECODER_Ctx *ctx, const BSL_Param *param);
62
70int32_t CRYPT_DECODE_GetParam(CRYPT_DECODER_Ctx *ctx, BSL_Param *param);
71
80int32_t CRYPT_DECODE_Decode(CRYPT_DECODER_Ctx *ctx, const BSL_Param *inParam, BSL_Param **outParam);
81
88void CRYPT_DECODE_FreeOutData(CRYPT_DECODER_Ctx *ctx, BSL_Param *outData);
89
90typedef struct CRYPT_DECODER_PoolCtx CRYPT_DECODER_PoolCtx;
91
95typedef enum {
97 CRYPT_DECODE_POOL_CMD_SET_TARGET_FORMAT,
99 CRYPT_DECODE_POOL_CMD_SET_TARGET_TYPE,
101 CRYPT_DECODE_POOL_CMD_SET_FLAG_FREE_OUT_DATA,
102} CRYPT_DECODE_POOL_CMD;
103
126CRYPT_DECODER_PoolCtx *CRYPT_DECODE_PoolNewCtx(CRYPT_EAL_LibCtx *libCtx, const char *attrName,
127 int32_t pkeyAlgId, const char *format, const char *type);
128
134void CRYPT_DECODE_PoolFreeCtx(CRYPT_DECODER_PoolCtx *poolCtx);
135
144int32_t CRYPT_DECODE_PoolDecode(CRYPT_DECODER_PoolCtx *poolCtx, const BSL_Param *inParam, BSL_Param **outParam);
145
155int32_t CRYPT_DECODE_PoolCtrl(CRYPT_DECODER_PoolCtx *poolCtx, int32_t cmd, void *val, int32_t valLen);
156
173int32_t CRYPT_EAL_DecodeBuffKey(int32_t format, int32_t type,
174 BSL_Buffer *encode, const uint8_t *pwd, uint32_t pwdlen, CRYPT_EAL_PkeyCtx **ealPKey);
175
206int32_t CRYPT_EAL_ProviderDecodeBuffKey(CRYPT_EAL_LibCtx *libCtx, const char *attrName, int32_t pkeyAlgId,
207 const char *format, const char *type, BSL_Buffer *encode, const BSL_Buffer *pwd, CRYPT_EAL_PkeyCtx **ealPKey);
208
223int32_t CRYPT_EAL_DecodeFileKey(int32_t format, int32_t type, const char *path,
224 uint8_t *pwd, uint32_t pwdlen, CRYPT_EAL_PkeyCtx **ealPKey);
225
254int32_t CRYPT_EAL_ProviderDecodeFileKey(CRYPT_EAL_LibCtx *libCtx, const char *attrName, int32_t pkeyAlgId,
255 const char *format, const char *type, const char *path, const BSL_Buffer *pwd, CRYPT_EAL_PkeyCtx **ealPKey);
256
271 int32_t format, int32_t type, BSL_Buffer *encode);
272
300int32_t CRYPT_EAL_ProviderEncodeBuffKey(CRYPT_EAL_LibCtx *libCtx, const char *attrName, CRYPT_EAL_PkeyCtx *ealPKey,
301 const CRYPT_EncodeParam *encodeParam, const char *format, const char *type, BSL_Buffer *encode);
302
317 int32_t format, int32_t type, const char *path);
318
346int32_t CRYPT_EAL_ProviderEncodeFileKey(CRYPT_EAL_LibCtx *libCtx, const char *attrName, CRYPT_EAL_PkeyCtx *ealPKey,
347 const CRYPT_EncodeParam *encodeParam, const char *format, const char *type, const char *path);
348
349#ifdef __cplusplus
350}
351#endif // __cplusplus
352
353#endif // CRYPT_EAL_CODECS_H
int32_t CRYPT_EAL_EncodeFileKey(CRYPT_EAL_PkeyCtx *ealPKey, const CRYPT_EncodeParam *encodeParam, int32_t format, int32_t type, const char *path)
Encode formatted file of pkey
int32_t CRYPT_EAL_ProviderDecodeFileKey(CRYPT_EAL_LibCtx *libCtx, const char *attrName, int32_t pkeyAlgId, const char *format, const char *type, const char *path, const BSL_Buffer *pwd, CRYPT_EAL_PkeyCtx **ealPKey)
Decode formatted file of pkey with extended parameters
int32_t CRYPT_EAL_ProviderEncodeFileKey(CRYPT_EAL_LibCtx *libCtx, const char *attrName, CRYPT_EAL_PkeyCtx *ealPKey, const CRYPT_EncodeParam *encodeParam, const char *format, const char *type, const char *path)
Encode formatted file of pkey with provider
int32_t CRYPT_EAL_ProviderEncodeBuffKey(CRYPT_EAL_LibCtx *libCtx, const char *attrName, CRYPT_EAL_PkeyCtx *ealPKey, const CRYPT_EncodeParam *encodeParam, const char *format, const char *type, BSL_Buffer *encode)
Encode formatted buffer of pkey with provider
int32_t CRYPT_EAL_DecodeBuffKey(int32_t format, int32_t type, BSL_Buffer *encode, const uint8_t *pwd, uint32_t pwdlen, CRYPT_EAL_PkeyCtx **ealPKey)
Decode formatted buffer of pkey
int32_t CRYPT_EAL_EncodeBuffKey(CRYPT_EAL_PkeyCtx *ealPKey, const CRYPT_EncodeParam *encodeParam, int32_t format, int32_t type, BSL_Buffer *encode)
Encode formatted buffer of pkey
int32_t CRYPT_EAL_ProviderDecodeBuffKey(CRYPT_EAL_LibCtx *libCtx, const char *attrName, int32_t pkeyAlgId, const char *format, const char *type, BSL_Buffer *encode, const BSL_Buffer *pwd, CRYPT_EAL_PkeyCtx **ealPKey)
Decode formatted buffer of pkey with provider
int32_t CRYPT_EAL_DecodeFileKey(int32_t format, int32_t type, const char *path, uint8_t *pwd, uint32_t pwdlen, CRYPT_EAL_PkeyCtx **ealPKey)
Decode formatted file of pkey
struct EAL_PkeyCtx CRYPT_EAL_PkeyCtx
定义 crypt_eal_pkey.h:108
定义 bsl_types.h:40
定义 crypt_types.h:931