Leancrypto 1.6.0
Post-Quantum Cryptographic Library
Loading...
Searching...
No Matches
lc_pkcs7_parser.h
Go to the documentation of this file.
1/*
2 * Copyright (C) 2024 - 2025, Stephan Mueller <smueller@chronox.de>
3 *
4 * License: see LICENSE file in root directory
5 *
6 * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED
7 * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
8 * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE, ALL OF
9 * WHICH ARE HEREBY DISCLAIMED. NO EVENT SHALL THE AUTHOR BE
10 * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
11 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT
12 * OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
13 * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
14 * LIABILITY, WHETHER CONTRACT, STRICT LIABILITY, OR TORT
15 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING ANY WAY OF THE
16 * USE OF THIS SOFTWARE, EVEN IF NOT ADVISED OF THE POSSIBILITY OF SUCH
17 * DAMAGE.
18 */
19
20#ifndef _CRYPTO_PKCS7_H
21#define _CRYPTO_PKCS7_H
22
23#include "ext_headers.h"
24#include "lc_hash.h"
25#include "lc_pkcs7_common.h"
26#include "lc_x509_parser.h"
27
79
108int lc_pkcs7_decode(struct lc_pkcs7_message *pkcs7, const uint8_t *data,
109 size_t datalen);
110
117void lc_pkcs7_message_clear(struct lc_pkcs7_message *pkcs7);
118
134int lc_pkcs7_get_content_data(const struct lc_pkcs7_message *pkcs7,
135 const uint8_t **data, size_t *datalen);
136
146
155 uint16_t required_eku;
156};
157
211int lc_pkcs7_verify(struct lc_pkcs7_message *pkcs7,
212 const struct lc_pkcs7_trust_store *trust_store,
213 const struct lc_verify_rules *verify_rules);
214
232int lc_pkcs7_supply_detached_data(struct lc_pkcs7_message *pkcs7,
233 const uint8_t *data, size_t datalen);
234
258int lc_pkcs7_get_digest(struct lc_pkcs7_message *pkcs7,
259 const uint8_t **message_digest,
260 size_t *message_digest_len,
261 const struct lc_hash **hash_algo);
262
287int lc_pkcs7_trust_store_add(struct lc_pkcs7_trust_store *trust_store,
288 struct lc_x509_certificate *x509);
289
296void lc_pkcs7_trust_store_clear(struct lc_pkcs7_trust_store *trust_store);
297
298#endif /* _CRYPTO_PKCS7_H */
int lc_hash(const struct lc_hash *hash, const uint8_t *in, size_t inlen, uint8_t *digest)
Calculate message digest - one-shot.
int lc_pkcs7_decode(struct lc_pkcs7_message *pkcs7, const uint8_t *data, size_t datalen)
Decode a PKCS#7 message.
void lc_pkcs7_message_clear(struct lc_pkcs7_message *pkcs7)
Clear the resources used by the PKCS#7 message parsing state.
int lc_pkcs7_verify(struct lc_pkcs7_message *pkcs7, const struct lc_pkcs7_trust_store *trust_store, const struct lc_verify_rules *verify_rules)
Verify a PKCS#7 message.
int lc_pkcs7_trust_store_add(struct lc_pkcs7_trust_store *trust_store, struct lc_x509_certificate *x509)
Add a certificate to a certificate trust store.
int lc_pkcs7_get_content_data(const struct lc_pkcs7_message *pkcs7, const uint8_t **data, size_t *datalen)
Get access to the PKCS#7 encapsulated content.
int lc_pkcs7_get_digest(struct lc_pkcs7_message *pkcs7, const uint8_t **message_digest, size_t *message_digest_len, const struct lc_hash **hash_algo)
Calculate and return the message digest of the data.
int lc_pkcs7_supply_detached_data(struct lc_pkcs7_message *pkcs7, const uint8_t *data, size_t datalen)
Supply the data needed to verify a PKCS#7 message.
void lc_pkcs7_trust_store_clear(struct lc_pkcs7_trust_store *trust_store)
Release and clear the trust store.
uint16_t required_keyusage