Mbed TLS v3.6.7
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 
42 #ifndef MBEDTLS_PKCS7_H
43 #define MBEDTLS_PKCS7_H
44 
45 #include "mbedtls/private_access.h"
46 
47 #include "mbedtls/build_info.h"
48 
49 #include "mbedtls/asn1.h"
50 #include "mbedtls/x509_crt.h"
51 
56 #define MBEDTLS_ERR_PKCS7_INVALID_FORMAT -0x5300
57 #define MBEDTLS_ERR_PKCS7_FEATURE_UNAVAILABLE -0x5380
58 #define MBEDTLS_ERR_PKCS7_INVALID_VERSION -0x5400
59 #define MBEDTLS_ERR_PKCS7_INVALID_CONTENT_INFO -0x5480
60 #define MBEDTLS_ERR_PKCS7_INVALID_ALG -0x5500
61 #define MBEDTLS_ERR_PKCS7_INVALID_CERT -0x5580
62 #define MBEDTLS_ERR_PKCS7_INVALID_SIGNATURE -0x5600
63 #define MBEDTLS_ERR_PKCS7_INVALID_SIGNER_INFO -0x5680
64 #define MBEDTLS_ERR_PKCS7_BAD_INPUT_DATA -0x5700
65 #define MBEDTLS_ERR_PKCS7_ALLOC_FAILED -0x5780
66 #define MBEDTLS_ERR_PKCS7_VERIFY_FAIL -0x5800
67 #define MBEDTLS_ERR_PKCS7_CERT_DATE_INVALID -0x5880
68 /* \} name */
69 
74 #define MBEDTLS_PKCS7_SUPPORTED_VERSION 0x01
75 /* \} name */
76 
77 #ifdef __cplusplus
78 extern "C" {
79 #endif
80 
85 
91 
96 
100 typedef enum {
108 }
110 
115  int MBEDTLS_PRIVATE(version);
120  mbedtls_x509_buf MBEDTLS_PRIVATE(sig_alg_identifier);
123 }
125 
130  int MBEDTLS_PRIVATE(version);
131  mbedtls_pkcs7_buf MBEDTLS_PRIVATE(digest_alg_identifiers);
132  int MBEDTLS_PRIVATE(no_of_certs);
134  int MBEDTLS_PRIVATE(no_of_crls);
136  int MBEDTLS_PRIVATE(no_of_signers);
138 }
140 
144 typedef struct mbedtls_pkcs7 {
147 }
149 
156 
173 int mbedtls_pkcs7_parse_der(mbedtls_pkcs7 *pkcs7, const unsigned char *buf,
174  const size_t buflen);
175 
205  const mbedtls_x509_crt *cert,
206  const unsigned char *data,
207  size_t datalen);
208 
237  const mbedtls_x509_crt *cert,
238  const unsigned char *hash, size_t hashlen);
239 
247 
248 #ifdef __cplusplus
249 }
250 #endif
251 
252 #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:84
mbedtls_asn1_sequence mbedtls_pkcs7_sequence
Definition: pkcs7.h:95
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:90
mbedtls_pkcs7_type
Definition: pkcs7.h:100
@ MBEDTLS_PKCS7_DIGESTED_DATA
Definition: pkcs7.h:106
@ MBEDTLS_PKCS7_NONE
Definition: pkcs7.h:101
@ MBEDTLS_PKCS7_SIGNED_AND_ENVELOPED_DATA
Definition: pkcs7.h:105
@ MBEDTLS_PKCS7_ENVELOPED_DATA
Definition: pkcs7.h:104
@ MBEDTLS_PKCS7_ENCRYPTED_DATA
Definition: pkcs7.h:107
@ MBEDTLS_PKCS7_SIGNED_DATA
Definition: pkcs7.h:103
@ MBEDTLS_PKCS7_DATA
Definition: pkcs7.h:102
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.