openHiTLS API openHiTLS 0.1.0-Alpha1
hitls_cert_reg.h
浏览该文件的文档.
1/*---------------------------------------------------------------------------------------------
2 * This file is part of the openHiTLS project.
3 * Copyright © 2023 Huawei Technologies Co.,Ltd. All rights reserved.
4 * Licensed under the openHiTLS Software license agreement 1.0. See LICENSE in the project root
5 * for license information.
6 *---------------------------------------------------------------------------------------------
7 */
8
15#ifndef HITLS_CERT_REG_H
16#define HITLS_CERT_REG_H
17
18#include <stdint.h>
19#include "hitls_crypt_type.h"
20#include "hitls_cert_type.h"
21#include "hitls_type.h"
22
23#ifdef __cplusplus
24extern "C" {
25#endif
26
35typedef HITLS_CERT_Store *(*CERT_StoreNewCallBack)(void);
36
45typedef HITLS_CERT_Store *(*CERT_StoreDupCallBack)(HITLS_CERT_Store *store);
46
56
70 void *input, void *output);
71
89 HITLS_CERT_X509 **certList, uint32_t *num);
90
104 HITLS_CERT_X509 **certList, uint32_t num);
105
118typedef int32_t (*CERT_CertEncodeCallBack)(HITLS_Ctx *ctx, HITLS_CERT_X509 *cert, uint8_t *buf, uint32_t len,
119 uint32_t *usedLen);
120
136typedef HITLS_CERT_X509 *(*CERT_CertParseCallBack)(HITLS_Config *config, const uint8_t *buf, uint32_t len,
138
147typedef HITLS_CERT_X509 *(*CERT_CertDupCallBack)(HITLS_CERT_X509 *cert);
148
157typedef HITLS_CERT_X509 *(*CERT_CertRefCallBack)(HITLS_CERT_X509 *cert);
158
168
182 void *input, void *output);
183
198typedef HITLS_CERT_Key *(*CERT_KeyParseCallBack)(HITLS_Config *config, const uint8_t *buf, uint32_t len,
200
209typedef HITLS_CERT_Key *(*CERT_KeyDupCallBack)(HITLS_CERT_Key *key);
210
220
234 void *input, void *output);
235
251typedef int32_t (*CERT_CreateSignCallBack)(HITLS_Ctx *ctx, HITLS_CERT_Key *key, HITLS_SignAlgo signAlgo,
252 HITLS_HashAlgo hashAlgo, const uint8_t *data, uint32_t dataLen, uint8_t *sign, uint32_t *signLen);
253
269typedef int32_t (*CERT_VerifySignCallBack)(HITLS_Ctx *ctx, HITLS_CERT_Key *key, HITLS_SignAlgo signAlgo,
270 HITLS_HashAlgo hashAlgo, const uint8_t *data, uint32_t dataLen, const uint8_t *sign, uint32_t signLen);
271
285typedef int32_t (*CERT_EncryptCallBack)(HITLS_Ctx *ctx, HITLS_CERT_Key *key, const uint8_t *in, uint32_t inLen,
286 uint8_t *out, uint32_t *outLen);
287
301typedef int32_t (*CERT_DecryptCallBack)(HITLS_Ctx *ctx, HITLS_CERT_Key *key, const uint8_t *in, uint32_t inLen,
302 uint8_t *out, uint32_t *outLen);
303
314typedef int32_t (*CERT_CheckPrivateKeyCallBack)(const HITLS_Config *config, HITLS_CERT_X509 *cert, HITLS_CERT_Key *key);
315
324
336
345typedef HITLS_CERT_USER_Key *(*CERT_UserKeyDupCallBack)(HITLS_CERT_USER_Key *key);
346
356
357typedef struct {
383
384typedef struct {
392
403
413
425
435
446
457
458#ifdef __cplusplus
459}
460#endif
461
462#endif /* HITLS_CERT_REG_H */
HITLS_HashAlgo
Hash algorithm enumeration
Definition hitls_crypt_type.h:77
HITLS_SignAlgo
Signature algorithm enumeration
Definition hitls_crypt_type.h:145
void(* CERT_KeyFreeCallBack)(HITLS_CERT_Key *key)
Release the certificate key.
Definition hitls_cert_reg.h:219
HITLS_CERT_Key *(* CERT_KeyDupCallBack)(HITLS_CERT_Key *key)
Duplicate the certificate key.
Definition hitls_cert_reg.h:209
int32_t(* CERT_CreateSignCallBack)(HITLS_Ctx *ctx, HITLS_CERT_Key *key, HITLS_SignAlgo signAlgo, HITLS_HashAlgo hashAlgo, const uint8_t *data, uint32_t dataLen, uint8_t *sign, uint32_t *signLen)
Signature
Definition hitls_cert_reg.h:251
void HITLS_CERT_DeinitUserKeyMgrMethod(void)
Callback functions related to the deregistration certificate UserKey
int32_t(* CERT_StoreCtrlCallBack)(HITLS_Config *config, HITLS_CERT_Store *store, HITLS_CERT_CtrlCmd cmd, void *input, void *output)
ctrl interface
Definition hitls_cert_reg.h:69
HITLS_CERT_Store *(* CERT_StoreNewCallBack)(void)
Create a certificate store
Definition hitls_cert_reg.h:35
int32_t HITLS_CERT_RegisterUserKeyMgrMethod(HITLS_CERT_UserKeyMgrMethod *method)
Callback function related to register the certificate UserKey. Before calling this API,...
int32_t(* CERT_DecryptCallBack)(HITLS_Ctx *ctx, HITLS_CERT_Key *key, const uint8_t *in, uint32_t inLen, uint8_t *out, uint32_t *outLen)
Use the certificate private key to decrypt the data.
Definition hitls_cert_reg.h:301
int32_t(* CERT_CertEncodeCallBack)(HITLS_Ctx *ctx, HITLS_CERT_X509 *cert, uint8_t *buf, uint32_t len, uint32_t *usedLen)
Encode the certificate in ASN.1 DER format.
Definition hitls_cert_reg.h:118
int32_t(* CERT_VerifySignCallBack)(HITLS_Ctx *ctx, HITLS_CERT_Key *key, HITLS_SignAlgo signAlgo, HITLS_HashAlgo hashAlgo, const uint8_t *data, uint32_t dataLen, const uint8_t *sign, uint32_t signLen)
Signature verification
Definition hitls_cert_reg.h:269
void(* CERT_StoreFreeCallBack)(HITLS_CERT_Store *store)
Release the certificate store.
Definition hitls_cert_reg.h:55
int32_t(* CERT_KeyFormUserKeyCallBack)(HITLS_CERT_USER_Key *srcKey, HITLS_CERT_Key **desKey)
Callback for converting the key of the upper layer user (adaptation layer) to the key of the bottom l...
Definition hitls_cert_reg.h:335
int32_t(* CERT_BuildCertChainCallBack)(HITLS_Config *config, HITLS_CERT_Store *store, HITLS_CERT_X509 *cert, HITLS_CERT_X509 **certList, uint32_t *num)
Create a certificate chain based on the device certificate in use.
Definition hitls_cert_reg.h:88
HITLS_CERT_X509 *(* CERT_CertParseCallBack)(HITLS_Config *config, const uint8_t *buf, uint32_t len, HITLS_ParseType type, HITLS_ParseFormat format)
Read the certificate.
Definition hitls_cert_reg.h:136
HITLS_CERT_Key *(* CERT_KeyParseCallBack)(HITLS_Config *config, const uint8_t *buf, uint32_t len, HITLS_ParseType type, HITLS_ParseFormat format)
Read the certificate key.
Definition hitls_cert_reg.h:198
int32_t(* CERT_KeyToUserKeyCallBack)(HITLS_CERT_Key *srcKey, HITLS_CERT_USER_Key **desKey)
Callback for converting the underlying key of the hitls to the upper layer user (adaptation layer)
Definition hitls_cert_reg.h:323
void(* CERT_UserKeyFreeCallBack)(HITLS_CERT_USER_Key *userKey)
Callback for releasing the key of the upper layer user (adaptation layer).
Definition hitls_cert_reg.h:355
int32_t HITLS_CERT_RegisterMgrMethod(HITLS_CERT_MgrMethod *method)
Callback function related to certificate registration
CERT_CheckPrivateKeyCallBack HITLS_CFG_GetCheckPriKeyCb(HITLS_Config *config)
Interface for obtaining the registered private key and certificate matching check
HITLS_CERT_X509 *(* CERT_CertDupCallBack)(HITLS_CERT_X509 *cert)
Duplicate the certificate.
Definition hitls_cert_reg.h:147
void HITLS_CERT_DeinitMgrMethod(void)
Certificate deregistration callback function
HITLS_CERT_X509 *(* CERT_CertRefCallBack)(HITLS_CERT_X509 *cert)
Certificate reference counting plus one.
Definition hitls_cert_reg.h:157
int32_t(* CERT_KeyCtrlCallBack)(HITLS_Config *config, HITLS_CERT_Key *key, HITLS_CERT_CtrlCmd cmd, void *input, void *output)
Ctrl interface
Definition hitls_cert_reg.h:233
int32_t(* CERT_VerifyCertChainCallBack)(HITLS_Ctx *ctx, HITLS_CERT_Store *store, HITLS_CERT_X509 **certList, uint32_t num)
Verify the certificate chain
Definition hitls_cert_reg.h:103
int32_t(* CERT_CertCtrlCallBack)(HITLS_Config *config, HITLS_CERT_X509 *cert, HITLS_CERT_CtrlCmd cmd, void *input, void *output)
Ctrl interface
Definition hitls_cert_reg.h:181
int32_t(* CERT_CheckPrivateKeyCallBack)(const HITLS_Config *config, HITLS_CERT_X509 *cert, HITLS_CERT_Key *key)
Check whether the private key matches the certificate.
Definition hitls_cert_reg.h:314
void(* CERT_CertFreeCallBack)(HITLS_CERT_X509 *cert)
Release the certificate.
Definition hitls_cert_reg.h:167
int32_t(* CERT_EncryptCallBack)(HITLS_Ctx *ctx, HITLS_CERT_Key *key, const uint8_t *in, uint32_t inLen, uint8_t *out, uint32_t *outLen)
Encrypted by the certificate public key.
Definition hitls_cert_reg.h:285
HITLS_CERT_Store *(* CERT_StoreDupCallBack)(HITLS_CERT_Store *store)
Duplicate the certificate store.
Definition hitls_cert_reg.h:45
HITLS_CERT_USER_Key *(* CERT_UserKeyDupCallBack)(HITLS_CERT_USER_Key *key)
Duplicate the certificate key.
Definition hitls_cert_reg.h:345
int32_t HITLS_CFG_SetCheckPriKeyCb(HITLS_Config *config, CERT_CheckPrivateKeyCallBack checkPrivateKey)
Register the private key with the config file and certificate matching Check Interface.
HITLS_ParseType
Read data format
Definition hitls_cert_type.h:95
void HITLS_CERT_Key
Describes the certificate key
Definition hitls_cert_type.h:34
void HITLS_CERT_USER_Key
Describes the user key type
Definition hitls_cert_type.h:40
HITLS_ParseFormat
Read data format
Definition hitls_cert_type.h:105
HITLS_CERT_CtrlCmd
ctrl option
Definition hitls_cert_type.h:70
void HITLS_CERT_Store
Describes the certificate
Definition hitls_cert_type.h:46
void HITLS_CERT_X509
Describes the x509 certificate
Definition hitls_cert_type.h:28
struct TlsCtx HITLS_Ctx
HITLS context
Definition hitls_type.h:28
struct TlsConfig HITLS_Config
config context
Definition hitls_type.h:34
CERT_VerifyCertChainCallBack verifyCertChain
Definition hitls_cert_reg.h:363
CERT_DecryptCallBack decrypt
Definition hitls_cert_reg.h:379
CERT_BuildCertChainCallBack buildCertChain
Definition hitls_cert_reg.h:362
CERT_KeyParseCallBack keyParse
Definition hitls_cert_reg.h:372
CERT_KeyDupCallBack keyDup
Definition hitls_cert_reg.h:373
CERT_StoreNewCallBack certStoreNew
Definition hitls_cert_reg.h:358
CERT_StoreCtrlCallBack certStoreCtrl
Definition hitls_cert_reg.h:361
CERT_CreateSignCallBack createSign
Definition hitls_cert_reg.h:376
CERT_KeyFreeCallBack keyFree
Definition hitls_cert_reg.h:374
CERT_CertCtrlCallBack certCtrl
Definition hitls_cert_reg.h:370
CERT_CheckPrivateKeyCallBack checkPrivateKey
Definition hitls_cert_reg.h:381
CERT_VerifySignCallBack verifySign
Definition hitls_cert_reg.h:377
CERT_EncryptCallBack encrypt
Definition hitls_cert_reg.h:378
CERT_StoreFreeCallBack certStoreFree
Definition hitls_cert_reg.h:360
CERT_CertEncodeCallBack certEncode
Definition hitls_cert_reg.h:365
CERT_CertFreeCallBack certFree
Definition hitls_cert_reg.h:369
CERT_KeyCtrlCallBack keyCtrl
Definition hitls_cert_reg.h:375
CERT_CertParseCallBack certParse
Definition hitls_cert_reg.h:366
CERT_CertDupCallBack certDup
Definition hitls_cert_reg.h:367
CERT_CertRefCallBack certRef
Definition hitls_cert_reg.h:368
CERT_StoreDupCallBack certStoreDup
Definition hitls_cert_reg.h:359
Definition hitls_cert_reg.h:357
CERT_UserKeyDupCallBack userKeyDup
Definition hitls_cert_reg.h:390
CERT_UserKeyFreeCallBack userKeyFree
Definition hitls_cert_reg.h:389
CERT_KeyToUserKeyCallBack keyToUserKey
Definition hitls_cert_reg.h:385
CERT_KeyFormUserKeyCallBack keyFormUserKey
Definition hitls_cert_reg.h:387
Definition hitls_cert_reg.h:384