OPTIGA Trust M  1.1.0
C++ library for Optiga Trust M Chip Security Controller
x509_csr.h
Go to the documentation of this file.
1 
6 /*
7  * Copyright (C) 2006-2015, ARM Limited, All Rights Reserved
8  * SPDX-License-Identifier: Apache-2.0
9  *
10  * Licensed under the Apache License, Version 2.0 (the "License"); you may
11  * not use this file except in compliance with the License.
12  * You may obtain a copy of the License at
13  *
14  * http://www.apache.org/licenses/LICENSE-2.0
15  *
16  * Unless required by applicable law or agreed to in writing, software
17  * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
18  * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
19  * See the License for the specific language governing permissions and
20  * limitations under the License.
21  *
22  * This file is part of mbed TLS (https://tls.mbed.org)
23  */
24 #ifndef MBEDTLS_X509_CSR_H
25 #define MBEDTLS_X509_CSR_H
26 
27 #if !defined(MBEDTLS_CONFIG_FILE)
28 #include "config.h"
29 #else
30 #include MBEDTLS_CONFIG_FILE
31 #endif
32 
33 #include "x509.h"
34 
35 #ifdef __cplusplus
36 extern "C" {
37 #endif
38 
51 typedef struct mbedtls_x509_csr
52 {
56  int version;
67  void *sig_opts;
68 }
70 
74 typedef struct mbedtls_x509write_csr
75 {
80 }
82 
83 #if defined(MBEDTLS_X509_CSR_PARSE_C)
84 
95 int mbedtls_x509_csr_parse_der( mbedtls_x509_csr *csr,
96  const unsigned char *buf, size_t buflen );
97 
110 int mbedtls_x509_csr_parse( mbedtls_x509_csr *csr, const unsigned char *buf, size_t buflen );
111 
112 #if defined(MBEDTLS_FS_IO)
113 
123 int mbedtls_x509_csr_parse_file( mbedtls_x509_csr *csr, const char *path );
124 #endif /* MBEDTLS_FS_IO */
125 
138 int mbedtls_x509_csr_info( char *buf, size_t size, const char *prefix,
139  const mbedtls_x509_csr *csr );
140 
146 void mbedtls_x509_csr_init( mbedtls_x509_csr *csr );
147 
153 void mbedtls_x509_csr_free( mbedtls_x509_csr *csr );
154 #endif /* MBEDTLS_X509_CSR_PARSE_C */
155 
156 /* \} name */
157 /* \} addtogroup x509_module */
158 
159 #if defined(MBEDTLS_X509_CSR_WRITE_C)
160 
165 void mbedtls_x509write_csr_init( mbedtls_x509write_csr *ctx );
166 
179 int mbedtls_x509write_csr_set_subject_name( mbedtls_x509write_csr *ctx,
180  const char *subject_name );
181 
189 void mbedtls_x509write_csr_set_key( mbedtls_x509write_csr *ctx, mbedtls_pk_context *key );
190 
198 void mbedtls_x509write_csr_set_md_alg( mbedtls_x509write_csr *ctx, mbedtls_md_type_t md_alg );
199 
209 int mbedtls_x509write_csr_set_key_usage( mbedtls_x509write_csr *ctx, unsigned char key_usage );
210 
220 int mbedtls_x509write_csr_set_ns_cert_type( mbedtls_x509write_csr *ctx,
221  unsigned char ns_cert_type );
222 
235 int mbedtls_x509write_csr_set_extension( mbedtls_x509write_csr *ctx,
236  const char *oid, size_t oid_len,
237  const unsigned char *val, size_t val_len );
238 
244 void mbedtls_x509write_csr_free( mbedtls_x509write_csr *ctx );
245 
267 int mbedtls_x509write_csr_der( mbedtls_x509write_csr *ctx, unsigned char *buf, size_t size,
268  int (*f_rng)(void *, unsigned char *, size_t),
269  void *p_rng );
270 
271 #if defined(MBEDTLS_PEM_WRITE_C)
272 
289 int mbedtls_x509write_csr_pem( mbedtls_x509write_csr *ctx, unsigned char *buf, size_t size,
290  int (*f_rng)(void *, unsigned char *, size_t),
291  void *p_rng );
292 #endif /* MBEDTLS_PEM_WRITE_C */
293 #endif /* MBEDTLS_X509_CSR_WRITE_C */
294 
295 #ifdef __cplusplus
296 }
297 #endif
298 
299 #endif /* mbedtls_x509_csr.h */
Definition: x509_csr.h:51
mbedtls_x509_buf sig
Definition: x509_csr.h:64
mbedtls_x509_name subject
Definition: x509_csr.h:59
Public key container.
Definition: pk.h:130
mbedtls_pk_context * key
Definition: x509_csr.h:76
int version
Definition: x509_csr.h:56
mbedtls_md_type_t sig_md
Definition: x509_csr.h:65
mbedtls_md_type_t md_alg
Definition: x509_csr.h:78
mbedtls_pk_type_t
Public key types.
Definition: pk.h:78
Configuration options (set of defines)
struct mbedtls_x509_csr mbedtls_x509_csr
mbedtls_asn1_named_data * extensions
Definition: x509_csr.h:79
mbedtls_pk_type_t sig_pk
Definition: x509_csr.h:66
Definition: asn1.h:166
mbedtls_x509_buf sig_oid
Definition: x509_csr.h:63
mbedtls_x509_buf raw
Definition: x509_csr.h:53
Definition: asn1.h:134
void * sig_opts
Definition: x509_csr.h:67
struct mbedtls_x509write_csr mbedtls_x509write_csr
mbedtls_x509_buf cri
Definition: x509_csr.h:54
X.509 generic defines and structures.
mbedtls_x509_buf subject_raw
Definition: x509_csr.h:58
Definition: x509_csr.h:74
mbedtls_asn1_named_data * subject
Definition: x509_csr.h:77
mbedtls_md_type_t
Supported message digests.
Definition: md.h:58
mbedtls_pk_context pk
Definition: x509_csr.h:61