Mbed TLS v3.5.2
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 OR GPL-2.0-or-later
10 */
11
36#ifndef MBEDTLS_PKCS7_H
37#define MBEDTLS_PKCS7_H
38
40
41#include "mbedtls/build_info.h"
42
43#include "mbedtls/asn1.h"
44#include "mbedtls/x509.h"
45#include "mbedtls/x509_crt.h"
46
51#define MBEDTLS_ERR_PKCS7_INVALID_FORMAT -0x5300
52#define MBEDTLS_ERR_PKCS7_FEATURE_UNAVAILABLE -0x5380
53#define MBEDTLS_ERR_PKCS7_INVALID_VERSION -0x5400
54#define MBEDTLS_ERR_PKCS7_INVALID_CONTENT_INFO -0x5480
55#define MBEDTLS_ERR_PKCS7_INVALID_ALG -0x5500
56#define MBEDTLS_ERR_PKCS7_INVALID_CERT -0x5580
57#define MBEDTLS_ERR_PKCS7_INVALID_SIGNATURE -0x5600
58#define MBEDTLS_ERR_PKCS7_INVALID_SIGNER_INFO -0x5680
59#define MBEDTLS_ERR_PKCS7_BAD_INPUT_DATA -0x5700
60#define MBEDTLS_ERR_PKCS7_ALLOC_FAILED -0x5780
61#define MBEDTLS_ERR_PKCS7_VERIFY_FAIL -0x5800
62#define MBEDTLS_ERR_PKCS7_CERT_DATE_INVALID -0x5880
63/* \} name */
64
69#define MBEDTLS_PKCS7_SUPPORTED_VERSION 0x01
70/* \} name */
71
72#ifdef __cplusplus
73extern "C" {
74#endif
75
80
86
91
95typedef enum {
103}
105
110 int MBEDTLS_PRIVATE(version);
118}
120
125 int MBEDTLS_PRIVATE(version);
126 mbedtls_pkcs7_buf MBEDTLS_PRIVATE(digest_alg_identifiers);
127 int MBEDTLS_PRIVATE(no_of_certs);
129 int MBEDTLS_PRIVATE(no_of_crls);
131 int MBEDTLS_PRIVATE(no_of_signers);
133}
135
139typedef struct mbedtls_pkcs7 {
142}
144
151
168int mbedtls_pkcs7_parse_der(mbedtls_pkcs7 *pkcs7, const unsigned char *buf,
169 const size_t buflen);
170
197 const mbedtls_x509_crt *cert,
198 const unsigned char *data,
199 size_t datalen);
200
226 const mbedtls_x509_crt *cert,
227 const unsigned char *hash, size_t hashlen);
228
236
237#ifdef __cplusplus
238}
239#endif
240
241#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.
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:79
mbedtls_asn1_sequence mbedtls_pkcs7_sequence
Definition pkcs7.h:90
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:85
mbedtls_pkcs7_type
Definition pkcs7.h:95
@ MBEDTLS_PKCS7_DIGESTED_DATA
Definition pkcs7.h:101
@ MBEDTLS_PKCS7_NONE
Definition pkcs7.h:96
@ MBEDTLS_PKCS7_SIGNED_AND_ENVELOPED_DATA
Definition pkcs7.h:100
@ MBEDTLS_PKCS7_ENVELOPED_DATA
Definition pkcs7.h:99
@ MBEDTLS_PKCS7_ENCRYPTED_DATA
Definition pkcs7.h:102
@ MBEDTLS_PKCS7_SIGNED_DATA
Definition pkcs7.h:98
@ MBEDTLS_PKCS7_DATA
Definition pkcs7.h:97
Macro wrapper for struct's members.
#define MBEDTLS_PRIVATE(member)
X.509 generic defines and structures.
X.509 certificate parsing and writing.