Mbed TLS v3.6.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 OR GPL-2.0-or-later
10  */
11 
36 #ifndef MBEDTLS_PKCS7_H
37 #define MBEDTLS_PKCS7_H
38 
39 #include "mbedtls/private_access.h"
40 
41 #include "mbedtls/build_info.h"
42 
43 #include "mbedtls/asn1.h"
44 #include "mbedtls/x509_crt.h"
45 
50 #define MBEDTLS_ERR_PKCS7_INVALID_FORMAT -0x5300
51 #define MBEDTLS_ERR_PKCS7_FEATURE_UNAVAILABLE -0x5380
52 #define MBEDTLS_ERR_PKCS7_INVALID_VERSION -0x5400
53 #define MBEDTLS_ERR_PKCS7_INVALID_CONTENT_INFO -0x5480
54 #define MBEDTLS_ERR_PKCS7_INVALID_ALG -0x5500
55 #define MBEDTLS_ERR_PKCS7_INVALID_CERT -0x5580
56 #define MBEDTLS_ERR_PKCS7_INVALID_SIGNATURE -0x5600
57 #define MBEDTLS_ERR_PKCS7_INVALID_SIGNER_INFO -0x5680
58 #define MBEDTLS_ERR_PKCS7_BAD_INPUT_DATA -0x5700
59 #define MBEDTLS_ERR_PKCS7_ALLOC_FAILED -0x5780
60 #define MBEDTLS_ERR_PKCS7_VERIFY_FAIL -0x5800
61 #define MBEDTLS_ERR_PKCS7_CERT_DATE_INVALID -0x5880
62 /* \} name */
63 
68 #define MBEDTLS_PKCS7_SUPPORTED_VERSION 0x01
69 /* \} name */
70 
71 #ifdef __cplusplus
72 extern "C" {
73 #endif
74 
79 
85 
90 
94 typedef enum {
102 }
104 
109  int MBEDTLS_PRIVATE(version);
114  mbedtls_x509_buf MBEDTLS_PRIVATE(sig_alg_identifier);
117 }
119 
124  int MBEDTLS_PRIVATE(version);
125  mbedtls_pkcs7_buf MBEDTLS_PRIVATE(digest_alg_identifiers);
126  int MBEDTLS_PRIVATE(no_of_certs);
128  int MBEDTLS_PRIVATE(no_of_crls);
130  int MBEDTLS_PRIVATE(no_of_signers);
132 }
134 
138 typedef struct mbedtls_pkcs7 {
141 }
143 
150 
167 int mbedtls_pkcs7_parse_der(mbedtls_pkcs7 *pkcs7, const unsigned char *buf,
168  const size_t buflen);
169 
196  const mbedtls_x509_crt *cert,
197  const unsigned char *data,
198  size_t datalen);
199 
225  const mbedtls_x509_crt *cert,
226  const unsigned char *hash, size_t hashlen);
227 
235 
236 #ifdef __cplusplus
237 }
238 #endif
239 
240 #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:78
mbedtls_asn1_sequence mbedtls_pkcs7_sequence
Definition: pkcs7.h:89
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:84
mbedtls_pkcs7_type
Definition: pkcs7.h:94
@ MBEDTLS_PKCS7_DIGESTED_DATA
Definition: pkcs7.h:100
@ MBEDTLS_PKCS7_NONE
Definition: pkcs7.h:95
@ MBEDTLS_PKCS7_SIGNED_AND_ENVELOPED_DATA
Definition: pkcs7.h:99
@ MBEDTLS_PKCS7_ENVELOPED_DATA
Definition: pkcs7.h:98
@ MBEDTLS_PKCS7_ENCRYPTED_DATA
Definition: pkcs7.h:101
@ MBEDTLS_PKCS7_SIGNED_DATA
Definition: pkcs7.h:97
@ MBEDTLS_PKCS7_DATA
Definition: pkcs7.h:96
struct mbedtls_pkcs7_signed_data mbedtls_pkcs7_signed_data
Macro wrapper for struct's members.
#define MBEDTLS_PRIVATE(member)
X.509 certificate parsing and writing.