mbed TLS v3.3.0
Loading...
Searching...
No Matches
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
51#ifndef MBEDTLS_PKCS7_H
52#define MBEDTLS_PKCS7_H
53
55
56#include "mbedtls/build_info.h"
57
58#include "mbedtls/asn1.h"
59#include "mbedtls/x509.h"
60#include "mbedtls/x509_crt.h"
61
66#define MBEDTLS_ERR_PKCS7_INVALID_FORMAT -0x5300
67#define MBEDTLS_ERR_PKCS7_FEATURE_UNAVAILABLE -0x5380
68#define MBEDTLS_ERR_PKCS7_INVALID_VERSION -0x5400
69#define MBEDTLS_ERR_PKCS7_INVALID_CONTENT_INFO -0x5480
70#define MBEDTLS_ERR_PKCS7_INVALID_ALG -0x5500
71#define MBEDTLS_ERR_PKCS7_INVALID_CERT -0x5580
72#define MBEDTLS_ERR_PKCS7_INVALID_SIGNATURE -0x5600
73#define MBEDTLS_ERR_PKCS7_INVALID_SIGNER_INFO -0x5680
74#define MBEDTLS_ERR_PKCS7_BAD_INPUT_DATA -0x5700
75#define MBEDTLS_ERR_PKCS7_ALLOC_FAILED -0x5780
76#define MBEDTLS_ERR_PKCS7_VERIFY_FAIL -0x5800
77#define MBEDTLS_ERR_PKCS7_CERT_DATE_INVALID -0x5880
78/* \} name */
79
84#define MBEDTLS_PKCS7_SUPPORTED_VERSION 0x01
85/* \} name */
86
87#ifdef __cplusplus
88extern "C" {
89#endif
90
95
101
106
110typedef enum {
118}
120
125{
126 int MBEDTLS_PRIVATE(version);
134}
136
140typedef struct mbedtls_pkcs7_data
141{
144}
146
151{
152 int MBEDTLS_PRIVATE(version);
153 mbedtls_pkcs7_buf MBEDTLS_PRIVATE(digest_alg_identifiers);
155 int MBEDTLS_PRIVATE(no_of_certs);
157 int MBEDTLS_PRIVATE(no_of_crls);
159 int MBEDTLS_PRIVATE(no_of_signers);
161}
163
167typedef struct mbedtls_pkcs7
168{
172}
174
181
196int mbedtls_pkcs7_parse_der( mbedtls_pkcs7 *pkcs7, const unsigned char *buf,
197 const size_t buflen );
198
224 const mbedtls_x509_crt *cert,
225 const unsigned char *data,
226 size_t datalen );
227
253 const mbedtls_x509_crt *cert,
254 const unsigned char *hash, size_t hashlen);
255
263
264#ifdef __cplusplus
265}
266#endif
267
268#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 pkcs7 content.
void mbedtls_pkcs7_init(mbedtls_pkcs7 *pkcs7)
Initialize 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 PKCS7 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 PKCS7 signature against a caller-supplied certificate.
mbedtls_asn1_buf mbedtls_pkcs7_buf
Definition: pkcs7.h:94
mbedtls_asn1_sequence mbedtls_pkcs7_sequence
Definition: pkcs7.h:105
void mbedtls_pkcs7_free(mbedtls_pkcs7 *pkcs7)
Unallocate all PKCS7 data and zeroize the memory. It doesn't free pkcs7 itself. It should be done by ...
mbedtls_asn1_named_data mbedtls_pkcs7_name
Definition: pkcs7.h:100
mbedtls_pkcs7_type
Definition: pkcs7.h:110
@ MBEDTLS_PKCS7_DIGESTED_DATA
Definition: pkcs7.h:116
@ MBEDTLS_PKCS7_NONE
Definition: pkcs7.h:111
@ MBEDTLS_PKCS7_SIGNED_AND_ENVELOPED_DATA
Definition: pkcs7.h:115
@ MBEDTLS_PKCS7_ENVELOPED_DATA
Definition: pkcs7.h:114
@ MBEDTLS_PKCS7_ENCRYPTED_DATA
Definition: pkcs7.h:117
@ MBEDTLS_PKCS7_SIGNED_DATA
Definition: pkcs7.h:113
@ MBEDTLS_PKCS7_DATA
Definition: pkcs7.h:112
Macro wrapper for struct's members.
#define MBEDTLS_PRIVATE(member)
X.509 generic defines and structures.
X.509 certificate parsing and writing.