Mbed TLS v3.5.0
pkcs7.h
Go to the documentation of this file.
1
7/*
8 * Copyright The Mbed TLS Contributors
9 * SPDX-License-Identifier: Apache-2.0
10 *
11 * Licensed under the Apache License, Version 2.0 (the "License"); you may
12 * not use this file except in compliance with the License.
13 * You may obtain a copy of the License at
14 *
15 * http://www.apache.org/licenses/LICENSE-2.0
16 *
17 * Unless required by applicable law or agreed to in writing, software
18 * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
19 * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
20 * See the License for the specific language governing permissions and
21 * limitations under the License.
22 */
23
48#ifndef MBEDTLS_PKCS7_H
49#define MBEDTLS_PKCS7_H
50
52
53#include "mbedtls/build_info.h"
54
55#include "mbedtls/asn1.h"
56#include "mbedtls/x509.h"
57#include "mbedtls/x509_crt.h"
58
63#define MBEDTLS_ERR_PKCS7_INVALID_FORMAT -0x5300
64#define MBEDTLS_ERR_PKCS7_FEATURE_UNAVAILABLE -0x5380
65#define MBEDTLS_ERR_PKCS7_INVALID_VERSION -0x5400
66#define MBEDTLS_ERR_PKCS7_INVALID_CONTENT_INFO -0x5480
67#define MBEDTLS_ERR_PKCS7_INVALID_ALG -0x5500
68#define MBEDTLS_ERR_PKCS7_INVALID_CERT -0x5580
69#define MBEDTLS_ERR_PKCS7_INVALID_SIGNATURE -0x5600
70#define MBEDTLS_ERR_PKCS7_INVALID_SIGNER_INFO -0x5680
71#define MBEDTLS_ERR_PKCS7_BAD_INPUT_DATA -0x5700
72#define MBEDTLS_ERR_PKCS7_ALLOC_FAILED -0x5780
73#define MBEDTLS_ERR_PKCS7_VERIFY_FAIL -0x5800
74#define MBEDTLS_ERR_PKCS7_CERT_DATE_INVALID -0x5880
75/* \} name */
76
81#define MBEDTLS_PKCS7_SUPPORTED_VERSION 0x01
82/* \} name */
83
84#ifdef __cplusplus
85extern "C" {
86#endif
87
92
98
103
107typedef enum {
115}
117
122 int MBEDTLS_PRIVATE(version);
130}
132
137 int MBEDTLS_PRIVATE(version);
138 mbedtls_pkcs7_buf MBEDTLS_PRIVATE(digest_alg_identifiers);
139 int MBEDTLS_PRIVATE(no_of_certs);
141 int MBEDTLS_PRIVATE(no_of_crls);
143 int MBEDTLS_PRIVATE(no_of_signers);
145}
147
151typedef struct mbedtls_pkcs7 {
154}
156
163
180int mbedtls_pkcs7_parse_der(mbedtls_pkcs7 *pkcs7, const unsigned char *buf,
181 const size_t buflen);
182
209 const mbedtls_x509_crt *cert,
210 const unsigned char *data,
211 size_t datalen);
212
238 const mbedtls_x509_crt *cert,
239 const unsigned char *hash, size_t hashlen);
240
248
249#ifdef __cplusplus
250}
251#endif
252
253#endif /* pkcs7.h */
Generic ASN.1 parsing.
Build-time configuration info.
int mbedtls_pkcs7_parse_der(mbedtls_pkcs7 *pkcs7, const unsigned char *buf, const size_t buflen)
Parse a single DER formatted PKCS #7 detached signature.
struct mbedtls_pkcs7 mbedtls_pkcs7
struct mbedtls_pkcs7_signer_info mbedtls_pkcs7_signer_info
void mbedtls_pkcs7_init(mbedtls_pkcs7 *pkcs7)
Initialize mbedtls_pkcs7 structure.
int mbedtls_pkcs7_signed_hash_verify(mbedtls_pkcs7 *pkcs7, const mbedtls_x509_crt *cert, const unsigned char *hash, size_t hashlen)
Verification of PKCS #7 signature against a caller-supplied certificate.
int mbedtls_pkcs7_signed_data_verify(mbedtls_pkcs7 *pkcs7, const mbedtls_x509_crt *cert, const unsigned char *data, size_t datalen)
Verification of PKCS #7 signature against a caller-supplied certificate.
mbedtls_asn1_buf mbedtls_pkcs7_buf
Definition: pkcs7.h:91
mbedtls_asn1_sequence mbedtls_pkcs7_sequence
Definition: pkcs7.h:102
void mbedtls_pkcs7_free(mbedtls_pkcs7 *pkcs7)
Unallocate all PKCS #7 data and zeroize the memory. It doesn't free pkcs7 itself. This should be done...
mbedtls_asn1_named_data mbedtls_pkcs7_name
Definition: pkcs7.h:97
mbedtls_pkcs7_type
Definition: pkcs7.h:107
@ MBEDTLS_PKCS7_DIGESTED_DATA
Definition: pkcs7.h:113
@ MBEDTLS_PKCS7_NONE
Definition: pkcs7.h:108
@ MBEDTLS_PKCS7_SIGNED_AND_ENVELOPED_DATA
Definition: pkcs7.h:112
@ MBEDTLS_PKCS7_ENVELOPED_DATA
Definition: pkcs7.h:111
@ MBEDTLS_PKCS7_ENCRYPTED_DATA
Definition: pkcs7.h:114
@ MBEDTLS_PKCS7_SIGNED_DATA
Definition: pkcs7.h:110
@ MBEDTLS_PKCS7_DATA
Definition: pkcs7.h:109
struct mbedtls_pkcs7_signed_data mbedtls_pkcs7_signed_data
Macro wrapper for struct's members.
#define MBEDTLS_PRIVATE(member)
X.509 generic defines and structures.
X.509 certificate parsing and writing.