20#ifndef LC_PKCS7_GENERATOR_H
21#define LC_PKCS7_GENERATOR_H
30struct lc_pkcs7_generate_context {
34 const struct lc_pkcs7_message *pkcs7;
40 const struct lc_x509_certificate *current_x509;
46 const struct lc_pkcs7_signed_info *current_sinfo;
48 unsigned long aa_set_applied;
49 uint16_t subject_attrib_processed;
52 const struct lc_hash *authattr_hash;
53 size_t authattrs_digest_size;
54 size_t authattrs_size;
55 uint8_t authattrs_digest[LC_SHA_MAX_SIZE_DIGEST];
56 uint8_t authattrs[LC_PKCS7_AUTHATTRS_MAX_SIZE];
65 enum OID signed_info_data_type;
120 size_t *avail_datalen);
164 const struct lc_pkcs7_message *pkcs7);
180 struct lc_pkcs7_generate_context *ctx,
enum OID oid);
206 size_t *avail_datalen);
228 struct lc_x509_certificate *x509);
271 struct lc_x509_certificate *x509_with_sk,
272 const struct lc_hash *signing_hash,
273 unsigned long auth_attribute);
315 const uint8_t *data,
size_t data_len,
int lc_hash(const struct lc_hash *hash, const uint8_t *in, size_t inlen, uint8_t *digest)
Calculate message digest - one-shot.
void lc_pkcs7_encode_ctx_clear(struct lc_pkcs7_generate_context *ctx)
Clear the context for encoding a PKCS#7 message.
int lc_pkcs7_set_signer(struct lc_pkcs7_message *pkcs7, struct lc_x509_certificate *x509_with_sk, const struct lc_hash *signing_hash, unsigned long auth_attribute)
Set an PKCS#7 certificate as signer for a PKCS#7 message.
int lc_pkcs7_encode_ctx_set_pkcs7(struct lc_pkcs7_generate_context *ctx, const struct lc_pkcs7_message *pkcs7)
Set the PKCS#7 message definition.
int lc_pkcs7_set_certificate(struct lc_pkcs7_message *pkcs7, struct lc_x509_certificate *x509)
Set an PKCS#7 certificate to be added to a PKCS#7 message.
int lc_pkcs7_encode_ctx_init(struct lc_pkcs7_generate_context *ctx)
Initialize a context for encoding a PKCS#7 message.
int lc_pkcs7_encode_ctx(struct lc_pkcs7_generate_context *ctx, uint8_t *data, size_t *avail_datalen)
Encode a PKCS#7 message using the provided context.
int lc_pkcs7_set_data(struct lc_pkcs7_message *pkcs7, const uint8_t *data, size_t data_len, enum lc_pkcs7_set_data_flags flags)
Set the data to be signed with PKCS#7.
int lc_pkcs7_encode(const struct lc_pkcs7_message *pkcs7, uint8_t *data, size_t *avail_datalen)
Encode a PKCS#7 message.
int lc_pkcs7_encode_ctx_set_signer_data_type(struct lc_pkcs7_generate_context *ctx, enum OID oid)
Set the PKCS#7 SignedData contentType.
int lc_pkcs7_set_data_with_type(struct lc_pkcs7_message *pkcs7, const uint8_t *data, size_t data_len, enum lc_pkcs7_set_data_flags flags, enum OID data_type)
Set the data to be signed with PKCS#7.
@ lc_pkcs7_set_data_embed
@ lc_pkcs7_set_data_noflag