x509_csr.h
Go to the documentation of this file.
#ifndef MBEDTLS_X509_CSR_H
#define MBEDTLS_X509_CSR_H
#if !defined(MBEDTLS_CONFIG_FILE)
#include "config.h"
#else
#include MBEDTLS_CONFIG_FILE
#endif
#include "x509.h"
#ifdef __cplusplus
extern "C" {
#endif
typedef struct mbedtls_x509_csr
{
mbedtls_x509_buf raw;
mbedtls_x509_buf cri;
int version;
mbedtls_x509_buf subject_raw;
mbedtls_x509_name subject;
mbedtls_pk_context pk;
mbedtls_x509_buf sig_oid;
mbedtls_x509_buf sig;
mbedtls_md_type_t sig_md;
mbedtls_pk_type_t sig_pk;
void *sig_opts;
}
mbedtls_x509_csr;
typedef struct mbedtls_x509write_csr
{
mbedtls_pk_context *key;
mbedtls_asn1_named_data *subject;
mbedtls_md_type_t md_alg;
mbedtls_asn1_named_data *extensions;
}
mbedtls_x509write_csr;
#if defined(MBEDTLS_X509_CSR_PARSE_C)
int mbedtls_x509_csr_parse_der( mbedtls_x509_csr *csr,
const unsigned char *buf, size_t buflen );
int mbedtls_x509_csr_parse( mbedtls_x509_csr *csr, const unsigned char *buf, size_t buflen );
#if defined(MBEDTLS_FS_IO)
int mbedtls_x509_csr_parse_file( mbedtls_x509_csr *csr, const char *path );
#endif /* MBEDTLS_FS_IO */
int mbedtls_x509_csr_info( char *buf, size_t size, const char *prefix,
const mbedtls_x509_csr *csr );
void mbedtls_x509_csr_init( mbedtls_x509_csr *csr );
void mbedtls_x509_csr_free( mbedtls_x509_csr *csr );
#endif /* MBEDTLS_X509_CSR_PARSE_C */
/* \} name */
/* \} addtogroup x509_module */
#if defined(MBEDTLS_X509_CSR_WRITE_C)
void mbedtls_x509write_csr_init( mbedtls_x509write_csr *ctx );
int mbedtls_x509write_csr_set_subject_name( mbedtls_x509write_csr *ctx,
const char *subject_name );
void mbedtls_x509write_csr_set_key( mbedtls_x509write_csr *ctx, mbedtls_pk_context *key );
void mbedtls_x509write_csr_set_md_alg( mbedtls_x509write_csr *ctx, mbedtls_md_type_t md_alg );
int mbedtls_x509write_csr_set_key_usage( mbedtls_x509write_csr *ctx, unsigned char key_usage );
int mbedtls_x509write_csr_set_ns_cert_type( mbedtls_x509write_csr *ctx,
unsigned char ns_cert_type );
int mbedtls_x509write_csr_set_extension( mbedtls_x509write_csr *ctx,
const char *oid, size_t oid_len,
const unsigned char *val, size_t val_len );
void mbedtls_x509write_csr_free( mbedtls_x509write_csr *ctx );
int mbedtls_x509write_csr_der( mbedtls_x509write_csr *ctx, unsigned char *buf, size_t size,
int (*f_rng)(void *, unsigned char *, size_t),
void *p_rng );
#if defined(MBEDTLS_PEM_WRITE_C)
int mbedtls_x509write_csr_pem( mbedtls_x509write_csr *ctx, unsigned char *buf, size_t size,
int (*f_rng)(void *, unsigned char *, size_t),
void *p_rng );
#endif /* MBEDTLS_PEM_WRITE_C */
#endif /* MBEDTLS_X509_CSR_WRITE_C */
#ifdef __cplusplus
}
#endif
#endif /* mbedtls_x509_csr.h */
mbedtls_x509_csr
Certificate Signing Request (CSR) structure.
Definition: x509_csr.h:50
mbedtls_x509_csr::sig
mbedtls_x509_buf sig
Definition: x509_csr.h:63
mbedtls_x509_csr::subject
mbedtls_x509_name subject
The parsed subject data (named information object).
Definition: x509_csr.h:58
mbedtls_x509write_csr_free
void mbedtls_x509write_csr_free(mbedtls_x509write_csr *ctx)
Free the contents of a CSR context.
mbedtls_pk_context
Public key container.
Definition: pk.h:126
mbedtls_x509write_csr_set_subject_name
int mbedtls_x509write_csr_set_subject_name(mbedtls_x509write_csr *ctx, const char *subject_name)
Set the subject name for a CSR Subject names should contain a comma-separated list of OID types and v...
mbedtls_x509_csr_parse
int mbedtls_x509_csr_parse(mbedtls_x509_csr *csr, const unsigned char *buf, size_t buflen)
Load a Certificate Signing Request (CSR), DER or PEM format.
mbedtls_x509write_csr_set_ns_cert_type
int mbedtls_x509write_csr_set_ns_cert_type(mbedtls_x509write_csr *ctx, unsigned char ns_cert_type)
Set the Netscape Cert Type flags (e.g.
mbedtls_x509write_csr_set_key
void mbedtls_x509write_csr_set_key(mbedtls_x509write_csr *ctx, mbedtls_pk_context *key)
Set the key for a CSR (public key will be included, private key used to sign the CSR when writing it)...
mbedtls_x509write_csr_der
int mbedtls_x509write_csr_der(mbedtls_x509write_csr *ctx, unsigned char *buf, size_t size, int(*f_rng)(void *, unsigned char *, size_t), void *p_rng)
Write a CSR (Certificate Signing Request) to a DER structure Note: data is written at the end of the ...
mbedtls_x509write_csr::key
mbedtls_pk_context * key
Definition: x509_csr.h:75
mbedtls_x509_csr::version
int version
CSR version (1=v1).
Definition: x509_csr.h:55
mbedtls_x509_csr::sig_md
mbedtls_md_type_t sig_md
Internal representation of the MD algorithm of the signature algorithm, e.g.
Definition: x509_csr.h:64
mbedtls_x509_csr_parse_file
int mbedtls_x509_csr_parse_file(mbedtls_x509_csr *csr, const char *path)
Load a Certificate Signing Request (CSR)
mbedtls_x509write_csr_init
void mbedtls_x509write_csr_init(mbedtls_x509write_csr *ctx)
Initialize a CSR context.
mbedtls_x509_csr_free
void mbedtls_x509_csr_free(mbedtls_x509_csr *csr)
Unallocate all CSR data.
mbedtls_x509write_csr_set_key_usage
int mbedtls_x509write_csr_set_key_usage(mbedtls_x509write_csr *ctx, unsigned char key_usage)
Set the Key Usage Extension flags (e.g.
mbedtls_x509write_csr::md_alg
mbedtls_md_type_t md_alg
Definition: x509_csr.h:77
mbedtls_pk_type_t
mbedtls_pk_type_t
Public key types.
Definition: pk.h:74
config.h
Configuration options (set of defines)
mbedtls_x509_csr
struct mbedtls_x509_csr mbedtls_x509_csr
Certificate Signing Request (CSR) structure.
mbedtls_x509write_csr::extensions
mbedtls_asn1_named_data * extensions
Definition: x509_csr.h:78
mbedtls_x509write_csr_set_extension
int mbedtls_x509write_csr_set_extension(mbedtls_x509write_csr *ctx, const char *oid, size_t oid_len, const unsigned char *val, size_t val_len)
Generic function to add to or replace an extension in the CSR.
mbedtls_x509_csr::sig_pk
mbedtls_pk_type_t sig_pk
Internal representation of the Public Key algorithm of the signature algorithm, e.g.
Definition: x509_csr.h:65
mbedtls_asn1_named_data
Container for a sequence or list of &#39;named&#39; ASN.1 data items.
Definition: asn1.h:150
mbedtls_x509_csr::sig_oid
mbedtls_x509_buf sig_oid
Definition: x509_csr.h:62
mbedtls_x509_csr_info
int mbedtls_x509_csr_info(char *buf, size_t size, const char *prefix, const mbedtls_x509_csr *csr)
Returns an informational string about the CSR.
mbedtls_x509_csr::raw
mbedtls_x509_buf raw
The raw CSR data (DER).
Definition: x509_csr.h:52
mbedtls_asn1_buf
Type-length-value structure that allows for ASN1 using DER.
Definition: asn1.h:118
mbedtls_x509_csr::sig_opts
void * sig_opts
Signature options to be passed to mbedtls_pk_verify_ext(), e.g.
Definition: x509_csr.h:66
mbedtls_x509_csr_init
void mbedtls_x509_csr_init(mbedtls_x509_csr *csr)
Initialize a CSR.
mbedtls_x509write_csr
struct mbedtls_x509write_csr mbedtls_x509write_csr
Container for writing a CSR.
mbedtls_x509_csr::cri
mbedtls_x509_buf cri
The raw CertificateRequestInfo body (DER).
Definition: x509_csr.h:53
x509.h
X.509 generic defines and structures.
mbedtls_x509_csr::subject_raw
mbedtls_x509_buf subject_raw
The raw subject data (DER).
Definition: x509_csr.h:57
mbedtls_x509write_csr
Container for writing a CSR.
Definition: x509_csr.h:73
mbedtls_x509write_csr_pem
int mbedtls_x509write_csr_pem(mbedtls_x509write_csr *ctx, unsigned char *buf, size_t size, int(*f_rng)(void *, unsigned char *, size_t), void *p_rng)
Write a CSR (Certificate Signing Request) to a PEM string.
mbedtls_x509write_csr::subject
mbedtls_asn1_named_data * subject
Definition: x509_csr.h:76
mbedtls_x509write_csr_set_md_alg
void mbedtls_x509write_csr_set_md_alg(mbedtls_x509write_csr *ctx, mbedtls_md_type_t md_alg)
Set the MD algorithm to use for the signature (e.g.
mbedtls_md_type_t
mbedtls_md_type_t
Definition: md.h:39
mbedtls_x509_csr::pk
mbedtls_pk_context pk
Container for the public key context.
Definition: x509_csr.h:60
mbedtls_x509_csr_parse_der
int mbedtls_x509_csr_parse_der(mbedtls_x509_csr *csr, const unsigned char *buf, size_t buflen)
Load a Certificate Signing Request (CSR) in DER format.