API参考
载入中...
搜索中...
未找到
bsl_asn1_internal.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
16#ifndef BSL_ASN1_INTERNAL_H
17#define BSL_ASN1_INTERNAL_H
18
19#include <stdint.h>
20#include <stdlib.h>
21#include <stdbool.h>
22#include "bsl_list.h"
23#include "bsl_uio.h"
24#include "bsl_asn1.h"
25
26#ifdef __cplusplus
27extern "C" {
28#endif
29
30#define BSL_ASN1_MAX_TEMPLATE_DEPTH 6
31
32#define BSL_ASN1_UTCTIME_LEN 13 // YYMMDDHHMMSSZ
33#define BSL_ASN1_GENERALIZEDTIME_LEN 15 // YYYYMMDDHHMMSSZ
34
35typedef enum {
36 BSL_ASN1_TYPE_GET_ANY_TAG = 0,
37 BSL_ASN1_TYPE_CHECK_CHOICE_TAG = 1
38} BSL_ASN1_CALLBACK_TYPE;
39
51int32_t BSL_ASN1_DecodeLen(uint8_t **encode, uint32_t *encLen, bool completeLen, uint32_t *len);
52
62int32_t BSL_ASN1_DecodePrimitiveItem(BSL_ASN1_Buffer *asn, void *decodeData);
63
74int32_t BSL_ASN1_DecodeItem(uint8_t **encode, uint32_t *encLen, BSL_ASN1_Buffer *asnItem);
75
85int32_t BSL_ASN1_GetCompleteLen(uint8_t *data, uint32_t *dataLen);
86
97int32_t BSL_ASN1_EncodeLimb(uint8_t tag, uint64_t limb, BSL_ASN1_Buffer *asn);
98
108int32_t BSL_ASN1_GetEncodeLen(uint32_t contentLen, uint32_t *encodeLen);
109
119int32_t BSL_ASN1_ToUtf8String(const BSL_ASN1_Buffer *in, BSL_ASN1_Buffer *out);
120
121
122#ifdef __cplusplus
123}
124#endif
125
126#endif // BSL_ASN1_INTERNAL_H