20#ifndef LC_X509_GENERATOR_H
21#define LC_X509_GENERATOR_H
73 size_t *avail_datalen);
92 size_t *avail_datalen);
104 const struct lc_x509_key_data *keys);
116 size_t *siglen,
const struct lc_x509_certificate *cert);
141 const struct lc_x509_key_data *keys,
const uint8_t *m,
142 size_t mlen,
const struct lc_hash *prehash_algo);
159 struct lc_x509_key_data *keys,
160 enum lc_sig_types create_keypair_algo);
182 const struct lc_x509_key_data *keys);
205 const struct lc_x509_key_data *signer_key_data,
206 const struct lc_x509_certificate *signer_x509);
291 const char *san_dns_name);
307 const uint8_t *san_ip,
size_t san_ip_len);
321 uint8_t *ip,
size_t *ip_len);
373 time64_t time_since_epoch);
385 time64_t time_since_epoch);
405 const char *
string,
size_t len);
425 const char *
string,
size_t len);
445 const char *
string,
size_t len);
465 const char *
string,
size_t len);
485 const char *
string,
size_t len);
505 const char *
string,
size_t len);
525 const char *
string,
size_t len);
545 const char *
string,
size_t len);
565 const char *
string,
size_t len);
585 const char *
string,
size_t len);
605 const char *
string,
size_t len);
625 const char *
string,
size_t len);
641 const uint8_t *serial,
size_t serial_len);
656 enum lc_sig_types *pkey_algo);
671 const struct lc_hash **hash_algo);
684 const char **hash_name);
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_x509_cert_set_eku(struct lc_x509_certificate *cert, const char *name)
Set the extended key usage from human readable form.
int lc_x509_pkey_name_to_algorithm(const char *name, enum lc_sig_types *pkey_algo)
Helper to convert the human readable name of a public key algorithm to its internal representation.
int lc_x509_cert_set_issuer_st(struct lc_x509_certificate *cert, const char *string, size_t len)
Set the issuer ST field tp the certificate.
int lc_x509_cert_set_valid_to(struct lc_x509_certificate *cert, time64_t time_since_epoch)
Set the valid-to data to the certificate.
int lc_x509_cert_set_issuer_email(struct lc_x509_certificate *cert, const char *string, size_t len)
Set the issuer email field tp the certificate.
int lc_x509_cert_set_subject_email(struct lc_x509_certificate *cert, const char *string, size_t len)
Set the subject email field tp the certificate.
int lc_x509_cert_set_subject_cn(struct lc_x509_certificate *cert, const char *string, size_t len)
Set the subject CN field tp the certificate.
int lc_x509_cert_set_akid(struct lc_x509_certificate *cert, const uint8_t *akid, size_t akidlen)
Set the AKID value.
int lc_x509_cert_set_skid(struct lc_x509_certificate *cert, const uint8_t *skid, size_t skidlen)
Set the SKID value.
int lc_x509_keypair_load(struct lc_x509_certificate *cert, const struct lc_x509_key_data *keys)
Load key pair it to the X.509 certificate.
int lc_x509_cert_set_issuer_ou(struct lc_x509_certificate *cert, const char *string, size_t len)
Set the issuer OU field tp the certificate.
int lc_x509_sk_encode(const struct lc_x509_key_data *gendata, uint8_t *data, size_t *avail_datalen)
Encode a private key DER structure.
int lc_x509_signature_gen(uint8_t *sig_data, size_t *siglen, const struct lc_x509_key_data *keys, const uint8_t *m, size_t mlen, const struct lc_hash *prehash_algo)
Generate signature over user-supplied data.
int lc_x509_cert_set_subject_st(struct lc_x509_certificate *cert, const char *string, size_t len)
Set the subject ST field tp the certificate.
int lc_x509_cert_set_ca(struct lc_x509_certificate *cert)
Mark the certificate to bear the basicConstraint CA.
int lc_x509_hash_to_name(const struct lc_hash *hash_algo, const char **hash_name)
Helper to convert the internal representation of a hash algorithm to its human readable form.
int lc_x509_cert_set_san_ip(struct lc_x509_certificate *cert, const uint8_t *san_ip, size_t san_ip_len)
Get the SAN IP value.
int lc_x509_name_to_hash(const char *hash_name, const struct lc_hash **hash_algo)
Helper to convert the human readable name of a hash algorithm to its internal representation.
int lc_x509_cert_set_issuer_c(struct lc_x509_certificate *cert, const char *string, size_t len)
Set the issuer C field tp the certificate.
int lc_x509_cert_set_subject_o(struct lc_x509_certificate *cert, const char *string, size_t len)
Set the subject O field tp the certificate.
int lc_x509_name_to_eku(const char *name, uint16_t *eku)
Helper to convert the human readable name of a EKU to its internal representation.
int lc_x509_cert_set_issuer_cn(struct lc_x509_certificate *cert, const char *string, size_t len)
Set the issuer CN field tp the certificate.
int lc_x509_cert_set_san_dns(struct lc_x509_certificate *cert, const char *san_dns_name)
Get the SAN DNS name.
int lc_x509_cert_set_serial(struct lc_x509_certificate *cert, const uint8_t *serial, size_t serial_len)
Set the serial number of the certificate.
int lc_x509_get_signature_size_from_sk(size_t *siglen, const struct lc_x509_key_data *keys)
Return signature size derived from private key information.
int lc_x509_cert_set_eku_val(struct lc_x509_certificate *cert, uint16_t val)
Set the extended key usage in integer form.
int lc_x509_cert_set_valid_from(struct lc_x509_certificate *cert, time64_t time_since_epoch)
Set the valid-from data to the certificate.
int lc_x509_name_to_keyusage(const char *name, uint16_t *keyusage)
Helper to convert the human readable name of a keyusage to its internal representation.
int lc_x509_cert_encode(const struct lc_x509_certificate *x509, uint8_t *data, size_t *avail_datalen)
Encode an X.509 certificate.
int lc_x509_enc_san_ip(struct lc_x509_certificate *cert, char *ip_name, uint8_t *ip, size_t *ip_len)
Helper to convert the human IP address value into binary form.
int lc_x509_keypair_gen(struct lc_x509_certificate *cert, struct lc_x509_key_data *keys, enum lc_sig_types create_keypair_algo)
Generate keypair and set it to the X.509 certificate.
int lc_x509_cert_set_issuer_o(struct lc_x509_certificate *cert, const char *string, size_t len)
Set the issuer O field tp the certificate.
int lc_x509_cert_set_signer(struct lc_x509_certificate *signed_x509, const struct lc_x509_key_data *signer_key_data, const struct lc_x509_certificate *signer_x509)
Set the signer X.509 certificate for a X.509 certificate.
int lc_x509_cert_set_subject_ou(struct lc_x509_certificate *cert, const char *string, size_t len)
Set the subject OU field tp the certificate.
int lc_x509_get_signature_size_from_cert(size_t *siglen, const struct lc_x509_certificate *cert)
Return signature size derived from certificate information.
int lc_x509_cert_set_keyusage_val(struct lc_x509_certificate *cert, uint16_t val)
Set the key usage in integer form.
int lc_x509_cert_set_keyusage(struct lc_x509_certificate *cert, const char *name)
Set the key usage from human readable form.
int lc_x509_cert_set_subject_c(struct lc_x509_certificate *cert, const char *string, size_t len)
Set the subject C field tp the certificate.