2013-09-06 09:55:26 +02:00
|
|
|
/*
|
|
|
|
* Certificate generation and signing
|
|
|
|
*
|
2015-07-27 11:11:48 +02:00
|
|
|
* Copyright (C) 2006-2015, ARM Limited, All Rights Reserved
|
2015-09-04 14:21:07 +02:00
|
|
|
* SPDX-License-Identifier: Apache-2.0
|
2013-09-06 09:55:26 +02:00
|
|
|
*
|
2015-09-04 14:21:07 +02:00
|
|
|
* Licensed under the Apache License, Version 2.0 (the "License"); you may
|
|
|
|
* not use this file except in compliance with the License.
|
|
|
|
* You may obtain a copy of the License at
|
2013-09-06 09:55:26 +02:00
|
|
|
*
|
2015-09-04 14:21:07 +02:00
|
|
|
* http://www.apache.org/licenses/LICENSE-2.0
|
2013-09-06 09:55:26 +02:00
|
|
|
*
|
2015-09-04 14:21:07 +02:00
|
|
|
* Unless required by applicable law or agreed to in writing, software
|
|
|
|
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
|
|
|
|
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
|
|
* See the License for the specific language governing permissions and
|
|
|
|
* limitations under the License.
|
2013-09-06 09:55:26 +02:00
|
|
|
*
|
2015-09-04 14:21:07 +02:00
|
|
|
* This file is part of mbed TLS (https://tls.mbed.org)
|
2013-09-06 09:55:26 +02:00
|
|
|
*/
|
|
|
|
|
2015-04-08 12:49:31 +02:00
|
|
|
#if !defined(MBEDTLS_CONFIG_FILE)
|
2015-03-09 18:05:11 +01:00
|
|
|
#include "mbedtls/config.h"
|
2014-04-29 12:39:06 +02:00
|
|
|
#else
|
2015-04-08 12:49:31 +02:00
|
|
|
#include MBEDTLS_CONFIG_FILE
|
2014-04-29 12:39:06 +02:00
|
|
|
#endif
|
2013-09-06 09:55:26 +02:00
|
|
|
|
2015-04-08 12:49:31 +02:00
|
|
|
#if defined(MBEDTLS_PLATFORM_C)
|
2015-03-09 18:05:11 +01:00
|
|
|
#include "mbedtls/platform.h"
|
2015-01-19 15:26:37 +01:00
|
|
|
#else
|
2015-02-11 15:06:19 +01:00
|
|
|
#include <stdio.h>
|
2015-04-08 12:49:31 +02:00
|
|
|
#define mbedtls_printf printf
|
2015-01-19 15:26:37 +01:00
|
|
|
#endif
|
|
|
|
|
2015-04-08 12:49:31 +02:00
|
|
|
#if !defined(MBEDTLS_X509_CRT_WRITE_C) || \
|
|
|
|
!defined(MBEDTLS_X509_CRT_PARSE_C) || !defined(MBEDTLS_FS_IO) || \
|
|
|
|
!defined(MBEDTLS_ENTROPY_C) || !defined(MBEDTLS_CTR_DRBG_C) || \
|
|
|
|
!defined(MBEDTLS_ERROR_C) || !defined(MBEDTLS_SHA256_C)
|
2015-03-31 15:10:03 +02:00
|
|
|
int main( void )
|
|
|
|
{
|
2015-04-08 12:49:31 +02:00
|
|
|
mbedtls_printf( "MBEDTLS_X509_CRT_WRITE_C and/or MBEDTLS_X509_CRT_PARSE_C and/or "
|
2015-08-06 18:22:26 +02:00
|
|
|
"MBEDTLS_FS_IO and/or MBEDTLS_SHA256_C and/or "
|
2015-04-08 12:49:31 +02:00
|
|
|
"MBEDTLS_ENTROPY_C and/or MBEDTLS_CTR_DRBG_C and/or "
|
|
|
|
"MBEDTLS_ERROR_C not defined.\n");
|
2015-03-31 15:10:03 +02:00
|
|
|
return( 0 );
|
|
|
|
}
|
|
|
|
#else
|
|
|
|
|
2015-03-09 18:05:11 +01:00
|
|
|
#include "mbedtls/x509_crt.h"
|
|
|
|
#include "mbedtls/x509_csr.h"
|
|
|
|
#include "mbedtls/entropy.h"
|
|
|
|
#include "mbedtls/ctr_drbg.h"
|
|
|
|
#include "mbedtls/error.h"
|
2013-09-20 12:29:56 +02:00
|
|
|
|
2015-02-11 15:06:19 +01:00
|
|
|
#include <stdio.h>
|
|
|
|
#include <stdlib.h>
|
|
|
|
#include <string.h>
|
|
|
|
|
2015-04-08 12:49:31 +02:00
|
|
|
#if defined(MBEDTLS_X509_CSR_PARSE_C)
|
2015-02-11 15:06:19 +01:00
|
|
|
#define USAGE_CSR \
|
|
|
|
" request_file=%%s default: (empty)\n" \
|
|
|
|
" If request_file is specified, subject_key,\n" \
|
|
|
|
" subject_pwd and subject_name are ignored!\n"
|
|
|
|
#else
|
|
|
|
#define USAGE_CSR ""
|
2015-04-08 12:49:31 +02:00
|
|
|
#endif /* MBEDTLS_X509_CSR_PARSE_C */
|
2015-02-11 15:06:19 +01:00
|
|
|
|
2013-09-09 13:59:42 +02:00
|
|
|
#define DFL_ISSUER_CRT ""
|
2013-09-09 15:52:07 +02:00
|
|
|
#define DFL_REQUEST_FILE ""
|
2013-09-06 09:55:26 +02:00
|
|
|
#define DFL_SUBJECT_KEY "subject.key"
|
|
|
|
#define DFL_ISSUER_KEY "ca.key"
|
|
|
|
#define DFL_SUBJECT_PWD ""
|
|
|
|
#define DFL_ISSUER_PWD ""
|
|
|
|
#define DFL_OUTPUT_FILENAME "cert.crt"
|
2015-01-22 17:26:39 +01:00
|
|
|
#define DFL_SUBJECT_NAME "CN=Cert,O=mbed TLS,C=UK"
|
|
|
|
#define DFL_ISSUER_NAME "CN=CA,O=mbed TLS,C=UK"
|
2013-09-06 09:55:26 +02:00
|
|
|
#define DFL_NOT_BEFORE "20010101000000"
|
|
|
|
#define DFL_NOT_AFTER "20301231235959"
|
|
|
|
#define DFL_SERIAL "1"
|
2013-09-09 16:24:18 +02:00
|
|
|
#define DFL_SELFSIGN 0
|
2013-09-06 19:27:21 +02:00
|
|
|
#define DFL_IS_CA 0
|
|
|
|
#define DFL_MAX_PATHLEN -1
|
2013-09-06 09:55:26 +02:00
|
|
|
#define DFL_KEY_USAGE 0
|
|
|
|
#define DFL_NS_CERT_TYPE 0
|
|
|
|
|
2015-02-11 15:06:19 +01:00
|
|
|
#define USAGE \
|
|
|
|
"\n usage: cert_write param=<>...\n" \
|
|
|
|
"\n acceptable parameters:\n" \
|
|
|
|
USAGE_CSR \
|
|
|
|
" subject_key=%%s default: subject.key\n" \
|
|
|
|
" subject_pwd=%%s default: (empty)\n" \
|
|
|
|
" subject_name=%%s default: CN=Cert,O=mbed TLS,C=UK\n" \
|
|
|
|
"\n" \
|
|
|
|
" issuer_crt=%%s default: (empty)\n" \
|
|
|
|
" If issuer_crt is specified, issuer_name is\n" \
|
|
|
|
" ignored!\n" \
|
|
|
|
" issuer_name=%%s default: CN=CA,O=mbed TLS,C=UK\n" \
|
|
|
|
"\n" \
|
|
|
|
" selfsign=%%d default: 0 (false)\n" \
|
|
|
|
" If selfsign is enabled, issuer_name and\n" \
|
|
|
|
" issuer_key are required (issuer_crt and\n" \
|
|
|
|
" subject_* are ignored\n" \
|
|
|
|
" issuer_key=%%s default: ca.key\n" \
|
|
|
|
" issuer_pwd=%%s default: (empty)\n" \
|
|
|
|
" output_file=%%s default: cert.crt\n" \
|
|
|
|
" serial=%%s default: 1\n" \
|
|
|
|
" not_before=%%s default: 20010101000000\n"\
|
|
|
|
" not_after=%%s default: 20301231235959\n"\
|
|
|
|
" is_ca=%%d default: 0 (disabled)\n" \
|
|
|
|
" max_pathlen=%%d default: -1 (none)\n" \
|
|
|
|
" key_usage=%%s default: (empty)\n" \
|
|
|
|
" Comma-separated-list of values:\n" \
|
|
|
|
" digital_signature\n" \
|
|
|
|
" non_repudiation\n" \
|
|
|
|
" key_encipherment\n" \
|
|
|
|
" data_encipherment\n" \
|
|
|
|
" key_agreement\n" \
|
2015-10-10 21:42:29 +02:00
|
|
|
" key_cert_sign\n" \
|
2015-02-11 15:06:19 +01:00
|
|
|
" crl_sign\n" \
|
|
|
|
" ns_cert_type=%%s default: (empty)\n" \
|
|
|
|
" Comma-separated-list of values:\n" \
|
|
|
|
" ssl_client\n" \
|
|
|
|
" ssl_server\n" \
|
|
|
|
" email\n" \
|
|
|
|
" object_signing\n" \
|
|
|
|
" ssl_ca\n" \
|
|
|
|
" email_ca\n" \
|
|
|
|
" object_signing_ca\n" \
|
|
|
|
"\n"
|
2015-02-13 15:12:07 +01:00
|
|
|
|
2013-09-06 09:55:26 +02:00
|
|
|
/*
|
|
|
|
* global options
|
|
|
|
*/
|
|
|
|
struct options
|
|
|
|
{
|
2013-11-25 13:29:43 +01:00
|
|
|
const char *issuer_crt; /* filename of the issuer certificate */
|
|
|
|
const char *request_file; /* filename of the certificate request */
|
|
|
|
const char *subject_key; /* filename of the subject key file */
|
|
|
|
const char *issuer_key; /* filename of the issuer key file */
|
|
|
|
const char *subject_pwd; /* password for the subject key file */
|
|
|
|
const char *issuer_pwd; /* password for the issuer key file */
|
|
|
|
const char *output_file; /* where to store the constructed key file */
|
|
|
|
const char *subject_name; /* subject name for certificate */
|
|
|
|
const char *issuer_name; /* issuer name for certificate */
|
|
|
|
const char *not_before; /* validity period not before */
|
|
|
|
const char *not_after; /* validity period not after */
|
|
|
|
const char *serial; /* serial number string */
|
2013-09-09 16:24:18 +02:00
|
|
|
int selfsign; /* selfsign the certificate */
|
2013-09-06 19:27:21 +02:00
|
|
|
int is_ca; /* is a CA certificate */
|
|
|
|
int max_pathlen; /* maximum CA path length */
|
2013-09-06 09:55:26 +02:00
|
|
|
unsigned char key_usage; /* key usage flags */
|
|
|
|
unsigned char ns_cert_type; /* NS cert type */
|
|
|
|
} opt;
|
|
|
|
|
2015-04-08 12:49:31 +02:00
|
|
|
int write_certificate( mbedtls_x509write_cert *crt, const char *output_file,
|
2013-09-12 05:59:05 +02:00
|
|
|
int (*f_rng)(void *, unsigned char *, size_t),
|
|
|
|
void *p_rng )
|
2013-09-06 09:55:26 +02:00
|
|
|
{
|
|
|
|
int ret;
|
|
|
|
FILE *f;
|
|
|
|
unsigned char output_buf[4096];
|
|
|
|
size_t len = 0;
|
|
|
|
|
|
|
|
memset( output_buf, 0, 4096 );
|
2015-04-08 12:49:31 +02:00
|
|
|
if( ( ret = mbedtls_x509write_crt_pem( crt, output_buf, 4096, f_rng, p_rng ) ) < 0 )
|
2013-09-06 09:55:26 +02:00
|
|
|
return( ret );
|
|
|
|
|
|
|
|
len = strlen( (char *) output_buf );
|
|
|
|
|
|
|
|
if( ( f = fopen( output_file, "w" ) ) == NULL )
|
|
|
|
return( -1 );
|
|
|
|
|
|
|
|
if( fwrite( output_buf, 1, len, f ) != len )
|
2014-04-17 16:02:36 +02:00
|
|
|
{
|
|
|
|
fclose( f );
|
2013-09-06 09:55:26 +02:00
|
|
|
return( -1 );
|
2014-04-17 16:02:36 +02:00
|
|
|
}
|
2013-09-06 09:55:26 +02:00
|
|
|
|
2014-04-17 16:02:36 +02:00
|
|
|
fclose( f );
|
2013-09-06 09:55:26 +02:00
|
|
|
|
|
|
|
return( 0 );
|
|
|
|
}
|
|
|
|
|
|
|
|
int main( int argc, char *argv[] )
|
|
|
|
{
|
|
|
|
int ret = 0;
|
2015-04-08 12:49:31 +02:00
|
|
|
mbedtls_x509_crt issuer_crt;
|
|
|
|
mbedtls_pk_context loaded_issuer_key, loaded_subject_key;
|
|
|
|
mbedtls_pk_context *issuer_key = &loaded_issuer_key,
|
2013-09-12 05:21:54 +02:00
|
|
|
*subject_key = &loaded_subject_key;
|
2013-09-06 09:55:26 +02:00
|
|
|
char buf[1024];
|
2015-10-10 21:58:07 +02:00
|
|
|
char issuer_name[256];
|
2013-11-30 15:13:02 +01:00
|
|
|
int i;
|
2013-09-06 09:55:26 +02:00
|
|
|
char *p, *q, *r;
|
2015-04-08 12:49:31 +02:00
|
|
|
#if defined(MBEDTLS_X509_CSR_PARSE_C)
|
2015-10-10 21:58:07 +02:00
|
|
|
char subject_name[256];
|
2015-04-08 12:49:31 +02:00
|
|
|
mbedtls_x509_csr csr;
|
2013-09-17 14:44:00 +02:00
|
|
|
#endif
|
2015-04-08 12:49:31 +02:00
|
|
|
mbedtls_x509write_cert crt;
|
|
|
|
mbedtls_mpi serial;
|
|
|
|
mbedtls_entropy_context entropy;
|
|
|
|
mbedtls_ctr_drbg_context ctr_drbg;
|
2013-09-12 05:59:05 +02:00
|
|
|
const char *pers = "crt example app";
|
2013-09-06 09:55:26 +02:00
|
|
|
|
|
|
|
/*
|
|
|
|
* Set to sane values
|
|
|
|
*/
|
2015-04-08 12:49:31 +02:00
|
|
|
mbedtls_x509write_crt_init( &crt );
|
|
|
|
mbedtls_x509write_crt_set_md_alg( &crt, MBEDTLS_MD_SHA256 );
|
|
|
|
mbedtls_pk_init( &loaded_issuer_key );
|
|
|
|
mbedtls_pk_init( &loaded_subject_key );
|
|
|
|
mbedtls_mpi_init( &serial );
|
2015-04-28 22:52:30 +02:00
|
|
|
mbedtls_ctr_drbg_init( &ctr_drbg );
|
2015-04-08 12:49:31 +02:00
|
|
|
#if defined(MBEDTLS_X509_CSR_PARSE_C)
|
|
|
|
mbedtls_x509_csr_init( &csr );
|
2013-09-17 14:44:00 +02:00
|
|
|
#endif
|
2015-04-08 12:49:31 +02:00
|
|
|
mbedtls_x509_crt_init( &issuer_crt );
|
2013-09-06 09:55:26 +02:00
|
|
|
memset( buf, 0, 1024 );
|
|
|
|
|
|
|
|
if( argc == 0 )
|
|
|
|
{
|
|
|
|
usage:
|
2015-04-08 12:49:31 +02:00
|
|
|
mbedtls_printf( USAGE );
|
2013-09-06 09:55:26 +02:00
|
|
|
ret = 1;
|
|
|
|
goto exit;
|
|
|
|
}
|
|
|
|
|
2013-09-09 13:59:42 +02:00
|
|
|
opt.issuer_crt = DFL_ISSUER_CRT;
|
2013-09-09 15:52:07 +02:00
|
|
|
opt.request_file = DFL_REQUEST_FILE;
|
2013-09-06 09:55:26 +02:00
|
|
|
opt.subject_key = DFL_SUBJECT_KEY;
|
|
|
|
opt.issuer_key = DFL_ISSUER_KEY;
|
|
|
|
opt.subject_pwd = DFL_SUBJECT_PWD;
|
|
|
|
opt.issuer_pwd = DFL_ISSUER_PWD;
|
|
|
|
opt.output_file = DFL_OUTPUT_FILENAME;
|
|
|
|
opt.subject_name = DFL_SUBJECT_NAME;
|
|
|
|
opt.issuer_name = DFL_ISSUER_NAME;
|
|
|
|
opt.not_before = DFL_NOT_BEFORE;
|
|
|
|
opt.not_after = DFL_NOT_AFTER;
|
|
|
|
opt.serial = DFL_SERIAL;
|
2013-09-09 16:24:18 +02:00
|
|
|
opt.selfsign = DFL_SELFSIGN;
|
2013-09-06 19:27:21 +02:00
|
|
|
opt.is_ca = DFL_IS_CA;
|
|
|
|
opt.max_pathlen = DFL_MAX_PATHLEN;
|
2013-09-06 09:55:26 +02:00
|
|
|
opt.key_usage = DFL_KEY_USAGE;
|
|
|
|
opt.ns_cert_type = DFL_NS_CERT_TYPE;
|
|
|
|
|
|
|
|
for( i = 1; i < argc; i++ )
|
|
|
|
{
|
|
|
|
|
|
|
|
p = argv[i];
|
|
|
|
if( ( q = strchr( p, '=' ) ) == NULL )
|
|
|
|
goto usage;
|
|
|
|
*q++ = '\0';
|
|
|
|
|
2013-09-09 15:52:07 +02:00
|
|
|
if( strcmp( p, "request_file" ) == 0 )
|
|
|
|
opt.request_file = q;
|
|
|
|
else if( strcmp( p, "subject_key" ) == 0 )
|
2013-09-06 09:55:26 +02:00
|
|
|
opt.subject_key = q;
|
|
|
|
else if( strcmp( p, "issuer_key" ) == 0 )
|
|
|
|
opt.issuer_key = q;
|
|
|
|
else if( strcmp( p, "subject_pwd" ) == 0 )
|
|
|
|
opt.subject_pwd = q;
|
|
|
|
else if( strcmp( p, "issuer_pwd" ) == 0 )
|
|
|
|
opt.issuer_pwd = q;
|
2013-09-09 13:59:42 +02:00
|
|
|
else if( strcmp( p, "issuer_crt" ) == 0 )
|
|
|
|
opt.issuer_crt = q;
|
2013-09-06 09:55:26 +02:00
|
|
|
else if( strcmp( p, "output_file" ) == 0 )
|
|
|
|
opt.output_file = q;
|
|
|
|
else if( strcmp( p, "subject_name" ) == 0 )
|
|
|
|
{
|
|
|
|
opt.subject_name = q;
|
|
|
|
}
|
|
|
|
else if( strcmp( p, "issuer_name" ) == 0 )
|
|
|
|
{
|
|
|
|
opt.issuer_name = q;
|
|
|
|
}
|
|
|
|
else if( strcmp( p, "not_before" ) == 0 )
|
|
|
|
{
|
|
|
|
opt.not_before = q;
|
|
|
|
}
|
|
|
|
else if( strcmp( p, "not_after" ) == 0 )
|
|
|
|
{
|
|
|
|
opt.not_after = q;
|
|
|
|
}
|
|
|
|
else if( strcmp( p, "serial" ) == 0 )
|
|
|
|
{
|
|
|
|
opt.serial = q;
|
|
|
|
}
|
2013-09-09 16:24:18 +02:00
|
|
|
else if( strcmp( p, "selfsign" ) == 0 )
|
|
|
|
{
|
|
|
|
opt.selfsign = atoi( q );
|
|
|
|
if( opt.selfsign < 0 || opt.selfsign > 1 )
|
|
|
|
goto usage;
|
|
|
|
}
|
2013-09-06 19:27:21 +02:00
|
|
|
else if( strcmp( p, "is_ca" ) == 0 )
|
|
|
|
{
|
|
|
|
opt.is_ca = atoi( q );
|
|
|
|
if( opt.is_ca < 0 || opt.is_ca > 1 )
|
|
|
|
goto usage;
|
|
|
|
}
|
|
|
|
else if( strcmp( p, "max_pathlen" ) == 0 )
|
|
|
|
{
|
|
|
|
opt.max_pathlen = atoi( q );
|
|
|
|
if( opt.max_pathlen < -1 || opt.max_pathlen > 127 )
|
|
|
|
goto usage;
|
|
|
|
}
|
2013-09-06 09:55:26 +02:00
|
|
|
else if( strcmp( p, "key_usage" ) == 0 )
|
|
|
|
{
|
|
|
|
while( q != NULL )
|
|
|
|
{
|
|
|
|
if( ( r = strchr( q, ',' ) ) != NULL )
|
|
|
|
*r++ = '\0';
|
|
|
|
|
|
|
|
if( strcmp( q, "digital_signature" ) == 0 )
|
2015-04-08 12:49:31 +02:00
|
|
|
opt.key_usage |= MBEDTLS_X509_KU_DIGITAL_SIGNATURE;
|
2013-09-06 09:55:26 +02:00
|
|
|
else if( strcmp( q, "non_repudiation" ) == 0 )
|
2015-04-08 12:49:31 +02:00
|
|
|
opt.key_usage |= MBEDTLS_X509_KU_NON_REPUDIATION;
|
2013-09-06 09:55:26 +02:00
|
|
|
else if( strcmp( q, "key_encipherment" ) == 0 )
|
2015-04-20 13:19:02 +02:00
|
|
|
opt.key_usage |= MBEDTLS_X509_KU_KEY_ENCIPHERMENT;
|
2013-09-06 09:55:26 +02:00
|
|
|
else if( strcmp( q, "data_encipherment" ) == 0 )
|
2015-04-20 13:19:02 +02:00
|
|
|
opt.key_usage |= MBEDTLS_X509_KU_DATA_ENCIPHERMENT;
|
2013-09-06 09:55:26 +02:00
|
|
|
else if( strcmp( q, "key_agreement" ) == 0 )
|
2015-04-20 13:19:02 +02:00
|
|
|
opt.key_usage |= MBEDTLS_X509_KU_KEY_AGREEMENT;
|
2013-09-06 09:55:26 +02:00
|
|
|
else if( strcmp( q, "key_cert_sign" ) == 0 )
|
2015-04-08 12:49:31 +02:00
|
|
|
opt.key_usage |= MBEDTLS_X509_KU_KEY_CERT_SIGN;
|
2013-09-06 09:55:26 +02:00
|
|
|
else if( strcmp( q, "crl_sign" ) == 0 )
|
2015-04-08 12:49:31 +02:00
|
|
|
opt.key_usage |= MBEDTLS_X509_KU_CRL_SIGN;
|
2013-09-06 09:55:26 +02:00
|
|
|
else
|
|
|
|
goto usage;
|
|
|
|
|
|
|
|
q = r;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else if( strcmp( p, "ns_cert_type" ) == 0 )
|
|
|
|
{
|
|
|
|
while( q != NULL )
|
|
|
|
{
|
|
|
|
if( ( r = strchr( q, ',' ) ) != NULL )
|
|
|
|
*r++ = '\0';
|
|
|
|
|
|
|
|
if( strcmp( q, "ssl_client" ) == 0 )
|
2015-04-08 12:49:31 +02:00
|
|
|
opt.ns_cert_type |= MBEDTLS_X509_NS_CERT_TYPE_SSL_CLIENT;
|
2013-09-06 09:55:26 +02:00
|
|
|
else if( strcmp( q, "ssl_server" ) == 0 )
|
2015-04-20 13:19:02 +02:00
|
|
|
opt.ns_cert_type |= MBEDTLS_X509_NS_CERT_TYPE_SSL_SERVER;
|
2013-09-06 09:55:26 +02:00
|
|
|
else if( strcmp( q, "email" ) == 0 )
|
2015-04-08 12:49:31 +02:00
|
|
|
opt.ns_cert_type |= MBEDTLS_X509_NS_CERT_TYPE_EMAIL;
|
2013-09-06 09:55:26 +02:00
|
|
|
else if( strcmp( q, "object_signing" ) == 0 )
|
2015-04-08 12:49:31 +02:00
|
|
|
opt.ns_cert_type |= MBEDTLS_X509_NS_CERT_TYPE_OBJECT_SIGNING;
|
2013-09-06 09:55:26 +02:00
|
|
|
else if( strcmp( q, "ssl_ca" ) == 0 )
|
2015-04-20 13:19:02 +02:00
|
|
|
opt.ns_cert_type |= MBEDTLS_X509_NS_CERT_TYPE_SSL_CA;
|
2013-09-06 09:55:26 +02:00
|
|
|
else if( strcmp( q, "email_ca" ) == 0 )
|
2015-04-20 13:19:02 +02:00
|
|
|
opt.ns_cert_type |= MBEDTLS_X509_NS_CERT_TYPE_EMAIL_CA;
|
2013-09-06 09:55:26 +02:00
|
|
|
else if( strcmp( q, "object_signing_ca" ) == 0 )
|
2015-04-20 13:19:02 +02:00
|
|
|
opt.ns_cert_type |= MBEDTLS_X509_NS_CERT_TYPE_OBJECT_SIGNING_CA;
|
2013-09-06 09:55:26 +02:00
|
|
|
else
|
|
|
|
goto usage;
|
|
|
|
|
|
|
|
q = r;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else
|
|
|
|
goto usage;
|
|
|
|
}
|
|
|
|
|
2015-04-08 12:49:31 +02:00
|
|
|
mbedtls_printf("\n");
|
2013-09-09 13:59:42 +02:00
|
|
|
|
2013-09-12 05:59:05 +02:00
|
|
|
/*
|
|
|
|
* 0. Seed the PRNG
|
|
|
|
*/
|
2015-04-08 12:49:31 +02:00
|
|
|
mbedtls_printf( " . Seeding the random number generator..." );
|
2013-09-12 05:59:05 +02:00
|
|
|
fflush( stdout );
|
|
|
|
|
2015-04-08 12:49:31 +02:00
|
|
|
mbedtls_entropy_init( &entropy );
|
2015-04-28 22:52:30 +02:00
|
|
|
if( ( ret = mbedtls_ctr_drbg_seed( &ctr_drbg, mbedtls_entropy_func, &entropy,
|
2013-09-12 05:59:05 +02:00
|
|
|
(const unsigned char *) pers,
|
|
|
|
strlen( pers ) ) ) != 0 )
|
|
|
|
{
|
2015-04-08 12:49:31 +02:00
|
|
|
mbedtls_strerror( ret, buf, 1024 );
|
2015-04-28 22:52:30 +02:00
|
|
|
mbedtls_printf( " failed\n ! mbedtls_ctr_drbg_seed returned %d - %s\n", ret, buf );
|
2013-09-12 05:59:05 +02:00
|
|
|
goto exit;
|
|
|
|
}
|
|
|
|
|
2015-04-08 12:49:31 +02:00
|
|
|
mbedtls_printf( " ok\n" );
|
2013-09-12 05:59:05 +02:00
|
|
|
|
2013-09-06 09:55:26 +02:00
|
|
|
// Parse serial to MPI
|
|
|
|
//
|
2015-04-08 12:49:31 +02:00
|
|
|
mbedtls_printf( " . Reading serial number..." );
|
2013-09-12 05:59:05 +02:00
|
|
|
fflush( stdout );
|
|
|
|
|
2015-04-08 12:49:31 +02:00
|
|
|
if( ( ret = mbedtls_mpi_read_string( &serial, 10, opt.serial ) ) != 0 )
|
2013-09-06 09:55:26 +02:00
|
|
|
{
|
2015-04-08 12:49:31 +02:00
|
|
|
mbedtls_strerror( ret, buf, 1024 );
|
|
|
|
mbedtls_printf( " failed\n ! mbedtls_mpi_read_string returned -0x%02x - %s\n\n", -ret, buf );
|
2013-09-06 09:55:26 +02:00
|
|
|
goto exit;
|
|
|
|
}
|
|
|
|
|
2015-04-08 12:49:31 +02:00
|
|
|
mbedtls_printf( " ok\n" );
|
2013-09-12 05:59:05 +02:00
|
|
|
|
2013-09-09 13:59:42 +02:00
|
|
|
// Parse issuer certificate if present
|
|
|
|
//
|
2013-09-09 16:24:18 +02:00
|
|
|
if( !opt.selfsign && strlen( opt.issuer_crt ) )
|
2013-09-09 13:59:42 +02:00
|
|
|
{
|
|
|
|
/*
|
2013-09-09 15:52:07 +02:00
|
|
|
* 1.0.a. Load the certificates
|
2013-09-09 13:59:42 +02:00
|
|
|
*/
|
2015-04-08 12:49:31 +02:00
|
|
|
mbedtls_printf( " . Loading the issuer certificate ..." );
|
2013-09-09 13:59:42 +02:00
|
|
|
fflush( stdout );
|
|
|
|
|
2015-04-08 12:49:31 +02:00
|
|
|
if( ( ret = mbedtls_x509_crt_parse_file( &issuer_crt, opt.issuer_crt ) ) != 0 )
|
2013-09-09 13:59:42 +02:00
|
|
|
{
|
2015-04-08 12:49:31 +02:00
|
|
|
mbedtls_strerror( ret, buf, 1024 );
|
|
|
|
mbedtls_printf( " failed\n ! mbedtls_x509_crt_parse_file returned -0x%02x - %s\n\n", -ret, buf );
|
2013-09-09 13:59:42 +02:00
|
|
|
goto exit;
|
|
|
|
}
|
|
|
|
|
2015-04-08 12:49:31 +02:00
|
|
|
ret = mbedtls_x509_dn_gets( issuer_name, sizeof(issuer_name),
|
2014-04-25 11:48:35 +02:00
|
|
|
&issuer_crt.subject );
|
2013-09-09 13:59:42 +02:00
|
|
|
if( ret < 0 )
|
|
|
|
{
|
2015-04-08 12:49:31 +02:00
|
|
|
mbedtls_strerror( ret, buf, 1024 );
|
|
|
|
mbedtls_printf( " failed\n ! mbedtls_x509_dn_gets returned -0x%02x - %s\n\n", -ret, buf );
|
2013-09-09 13:59:42 +02:00
|
|
|
goto exit;
|
|
|
|
}
|
|
|
|
|
2013-09-09 15:52:07 +02:00
|
|
|
opt.issuer_name = issuer_name;
|
|
|
|
|
2015-04-08 12:49:31 +02:00
|
|
|
mbedtls_printf( " ok\n" );
|
2013-09-09 15:52:07 +02:00
|
|
|
}
|
|
|
|
|
2015-04-08 12:49:31 +02:00
|
|
|
#if defined(MBEDTLS_X509_CSR_PARSE_C)
|
2013-09-09 15:52:07 +02:00
|
|
|
// Parse certificate request if present
|
|
|
|
//
|
2013-09-09 16:24:18 +02:00
|
|
|
if( !opt.selfsign && strlen( opt.request_file ) )
|
2013-09-09 15:52:07 +02:00
|
|
|
{
|
|
|
|
/*
|
|
|
|
* 1.0.b. Load the CSR
|
|
|
|
*/
|
2015-04-08 12:49:31 +02:00
|
|
|
mbedtls_printf( " . Loading the certificate request ..." );
|
2013-09-09 15:52:07 +02:00
|
|
|
fflush( stdout );
|
|
|
|
|
2015-04-08 12:49:31 +02:00
|
|
|
if( ( ret = mbedtls_x509_csr_parse_file( &csr, opt.request_file ) ) != 0 )
|
2013-09-09 15:52:07 +02:00
|
|
|
{
|
2015-04-08 12:49:31 +02:00
|
|
|
mbedtls_strerror( ret, buf, 1024 );
|
|
|
|
mbedtls_printf( " failed\n ! mbedtls_x509_csr_parse_file returned -0x%02x - %s\n\n", -ret, buf );
|
2013-09-09 15:52:07 +02:00
|
|
|
goto exit;
|
|
|
|
}
|
|
|
|
|
2015-04-08 12:49:31 +02:00
|
|
|
ret = mbedtls_x509_dn_gets( subject_name, sizeof(subject_name),
|
2013-09-09 15:52:07 +02:00
|
|
|
&csr.subject );
|
|
|
|
if( ret < 0 )
|
|
|
|
{
|
2015-04-08 12:49:31 +02:00
|
|
|
mbedtls_strerror( ret, buf, 1024 );
|
|
|
|
mbedtls_printf( " failed\n ! mbedtls_x509_dn_gets returned -0x%02x - %s\n\n", -ret, buf );
|
2013-09-09 15:52:07 +02:00
|
|
|
goto exit;
|
|
|
|
}
|
|
|
|
|
|
|
|
opt.subject_name = subject_name;
|
2013-09-12 05:21:54 +02:00
|
|
|
subject_key = &csr.pk;
|
2013-09-09 13:59:42 +02:00
|
|
|
|
2015-04-08 12:49:31 +02:00
|
|
|
mbedtls_printf( " ok\n" );
|
2013-09-09 13:59:42 +02:00
|
|
|
}
|
2015-04-08 12:49:31 +02:00
|
|
|
#endif /* MBEDTLS_X509_CSR_PARSE_C */
|
2013-09-09 13:59:42 +02:00
|
|
|
|
2013-09-06 09:55:26 +02:00
|
|
|
/*
|
|
|
|
* 1.1. Load the keys
|
|
|
|
*/
|
2013-09-09 16:24:18 +02:00
|
|
|
if( !opt.selfsign && !strlen( opt.request_file ) )
|
2013-09-06 09:55:26 +02:00
|
|
|
{
|
2015-04-08 12:49:31 +02:00
|
|
|
mbedtls_printf( " . Loading the subject key ..." );
|
2013-09-09 15:52:07 +02:00
|
|
|
fflush( stdout );
|
|
|
|
|
2015-04-08 12:49:31 +02:00
|
|
|
ret = mbedtls_pk_parse_keyfile( &loaded_subject_key, opt.subject_key,
|
2013-09-12 05:21:54 +02:00
|
|
|
opt.subject_pwd );
|
2013-09-09 15:52:07 +02:00
|
|
|
if( ret != 0 )
|
|
|
|
{
|
2015-04-08 12:49:31 +02:00
|
|
|
mbedtls_strerror( ret, buf, 1024 );
|
|
|
|
mbedtls_printf( " failed\n ! mbedtls_pk_parse_keyfile returned -0x%02x - %s\n\n", -ret, buf );
|
2013-09-09 15:52:07 +02:00
|
|
|
goto exit;
|
|
|
|
}
|
|
|
|
|
2015-04-08 12:49:31 +02:00
|
|
|
mbedtls_printf( " ok\n" );
|
2013-09-06 09:55:26 +02:00
|
|
|
}
|
|
|
|
|
2015-04-08 12:49:31 +02:00
|
|
|
mbedtls_printf( " . Loading the issuer key ..." );
|
2013-09-06 09:55:26 +02:00
|
|
|
fflush( stdout );
|
|
|
|
|
2015-04-08 12:49:31 +02:00
|
|
|
ret = mbedtls_pk_parse_keyfile( &loaded_issuer_key, opt.issuer_key,
|
2013-09-15 13:01:22 +02:00
|
|
|
opt.issuer_pwd );
|
2013-09-06 09:55:26 +02:00
|
|
|
if( ret != 0 )
|
|
|
|
{
|
2015-04-08 12:49:31 +02:00
|
|
|
mbedtls_strerror( ret, buf, 1024 );
|
|
|
|
mbedtls_printf( " failed\n ! mbedtls_pk_parse_keyfile returned -x%02x - %s\n\n", -ret, buf );
|
2013-09-06 09:55:26 +02:00
|
|
|
goto exit;
|
|
|
|
}
|
|
|
|
|
2013-09-09 13:59:42 +02:00
|
|
|
// Check if key and issuer certificate match
|
|
|
|
//
|
|
|
|
if( strlen( opt.issuer_crt ) )
|
|
|
|
{
|
2015-04-08 12:49:31 +02:00
|
|
|
if( !mbedtls_pk_can_do( &issuer_crt.pk, MBEDTLS_PK_RSA ) ||
|
|
|
|
mbedtls_mpi_cmp_mpi( &mbedtls_pk_rsa( issuer_crt.pk )->N,
|
|
|
|
&mbedtls_pk_rsa( *issuer_key )->N ) != 0 ||
|
|
|
|
mbedtls_mpi_cmp_mpi( &mbedtls_pk_rsa( issuer_crt.pk )->E,
|
|
|
|
&mbedtls_pk_rsa( *issuer_key )->E ) != 0 )
|
2013-09-09 13:59:42 +02:00
|
|
|
{
|
2015-04-08 12:49:31 +02:00
|
|
|
mbedtls_printf( " failed\n ! issuer_key does not match issuer certificate\n\n" );
|
2013-09-09 13:59:42 +02:00
|
|
|
ret = -1;
|
|
|
|
goto exit;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2015-04-08 12:49:31 +02:00
|
|
|
mbedtls_printf( " ok\n" );
|
2013-09-06 09:55:26 +02:00
|
|
|
|
2013-09-09 16:24:18 +02:00
|
|
|
if( opt.selfsign )
|
|
|
|
{
|
2013-10-28 22:28:09 +01:00
|
|
|
opt.subject_name = opt.issuer_name;
|
2013-09-12 05:21:54 +02:00
|
|
|
subject_key = issuer_key;
|
2013-09-09 16:24:18 +02:00
|
|
|
}
|
|
|
|
|
2015-04-08 12:49:31 +02:00
|
|
|
mbedtls_x509write_crt_set_subject_key( &crt, subject_key );
|
|
|
|
mbedtls_x509write_crt_set_issuer_key( &crt, issuer_key );
|
2013-09-09 16:24:18 +02:00
|
|
|
|
|
|
|
/*
|
|
|
|
* 1.0. Check the names for validity
|
|
|
|
*/
|
2015-04-08 12:49:31 +02:00
|
|
|
if( ( ret = mbedtls_x509write_crt_set_subject_name( &crt, opt.subject_name ) ) != 0 )
|
2013-09-09 16:24:18 +02:00
|
|
|
{
|
2015-04-08 12:49:31 +02:00
|
|
|
mbedtls_strerror( ret, buf, 1024 );
|
|
|
|
mbedtls_printf( " failed\n ! mbedtls_x509write_crt_set_subject_name returned -0x%02x - %s\n\n", -ret, buf );
|
2013-09-09 16:24:18 +02:00
|
|
|
goto exit;
|
|
|
|
}
|
|
|
|
|
2015-04-08 12:49:31 +02:00
|
|
|
if( ( ret = mbedtls_x509write_crt_set_issuer_name( &crt, opt.issuer_name ) ) != 0 )
|
2013-09-09 16:24:18 +02:00
|
|
|
{
|
2015-04-08 12:49:31 +02:00
|
|
|
mbedtls_strerror( ret, buf, 1024 );
|
|
|
|
mbedtls_printf( " failed\n ! mbedtls_x509write_crt_set_issuer_name returned -0x%02x - %s\n\n", -ret, buf );
|
2013-09-09 16:24:18 +02:00
|
|
|
goto exit;
|
|
|
|
}
|
|
|
|
|
2015-04-08 12:49:31 +02:00
|
|
|
mbedtls_printf( " . Setting certificate values ..." );
|
2013-09-06 09:55:26 +02:00
|
|
|
fflush( stdout );
|
|
|
|
|
2015-04-08 12:49:31 +02:00
|
|
|
ret = mbedtls_x509write_crt_set_serial( &crt, &serial );
|
2013-09-06 09:55:26 +02:00
|
|
|
if( ret != 0 )
|
|
|
|
{
|
2015-04-08 12:49:31 +02:00
|
|
|
mbedtls_strerror( ret, buf, 1024 );
|
|
|
|
mbedtls_printf( " failed\n ! mbedtls_x509write_crt_set_serial returned -0x%02x - %s\n\n", -ret, buf );
|
2013-09-06 09:55:26 +02:00
|
|
|
goto exit;
|
|
|
|
}
|
|
|
|
|
2015-04-08 12:49:31 +02:00
|
|
|
ret = mbedtls_x509write_crt_set_validity( &crt, opt.not_before, opt.not_after );
|
2013-09-06 09:55:26 +02:00
|
|
|
if( ret != 0 )
|
|
|
|
{
|
2015-04-08 12:49:31 +02:00
|
|
|
mbedtls_strerror( ret, buf, 1024 );
|
|
|
|
mbedtls_printf( " failed\n ! mbedtls_x509write_crt_set_validity returned -0x%02x - %s\n\n", -ret, buf );
|
2013-09-06 09:55:26 +02:00
|
|
|
goto exit;
|
|
|
|
}
|
|
|
|
|
2015-04-08 12:49:31 +02:00
|
|
|
mbedtls_printf( " ok\n" );
|
2013-09-06 09:55:26 +02:00
|
|
|
|
2015-04-08 12:49:31 +02:00
|
|
|
mbedtls_printf( " . Adding the Basic Constraints extension ..." );
|
2013-09-06 19:27:21 +02:00
|
|
|
fflush( stdout );
|
|
|
|
|
2015-04-08 12:49:31 +02:00
|
|
|
ret = mbedtls_x509write_crt_set_basic_constraints( &crt, opt.is_ca,
|
2013-09-06 19:27:21 +02:00
|
|
|
opt.max_pathlen );
|
|
|
|
if( ret != 0 )
|
|
|
|
{
|
2015-04-08 12:49:31 +02:00
|
|
|
mbedtls_strerror( ret, buf, 1024 );
|
|
|
|
mbedtls_printf( " failed\n ! x509write_crt_set_basic_contraints returned -0x%02x - %s\n\n", -ret, buf );
|
2013-09-06 19:27:21 +02:00
|
|
|
goto exit;
|
|
|
|
}
|
|
|
|
|
2015-04-08 12:49:31 +02:00
|
|
|
mbedtls_printf( " ok\n" );
|
2013-09-06 19:27:21 +02:00
|
|
|
|
2015-04-08 12:49:31 +02:00
|
|
|
#if defined(MBEDTLS_SHA1_C)
|
|
|
|
mbedtls_printf( " . Adding the Subject Key Identifier ..." );
|
2013-09-06 19:27:21 +02:00
|
|
|
fflush( stdout );
|
|
|
|
|
2015-04-08 12:49:31 +02:00
|
|
|
ret = mbedtls_x509write_crt_set_subject_key_identifier( &crt );
|
2013-09-06 19:27:21 +02:00
|
|
|
if( ret != 0 )
|
|
|
|
{
|
2015-04-08 12:49:31 +02:00
|
|
|
mbedtls_strerror( ret, buf, 1024 );
|
|
|
|
mbedtls_printf( " failed\n ! mbedtls_x509write_crt_set_subject_key_identifier returned -0x%02x - %s\n\n", -ret, buf );
|
2013-09-06 19:27:21 +02:00
|
|
|
goto exit;
|
|
|
|
}
|
|
|
|
|
2015-04-08 12:49:31 +02:00
|
|
|
mbedtls_printf( " ok\n" );
|
2013-09-06 19:27:21 +02:00
|
|
|
|
2015-04-08 12:49:31 +02:00
|
|
|
mbedtls_printf( " . Adding the Authority Key Identifier ..." );
|
2013-09-06 19:27:21 +02:00
|
|
|
fflush( stdout );
|
|
|
|
|
2015-04-08 12:49:31 +02:00
|
|
|
ret = mbedtls_x509write_crt_set_authority_key_identifier( &crt );
|
2013-09-06 19:27:21 +02:00
|
|
|
if( ret != 0 )
|
|
|
|
{
|
2015-04-08 12:49:31 +02:00
|
|
|
mbedtls_strerror( ret, buf, 1024 );
|
|
|
|
mbedtls_printf( " failed\n ! mbedtls_x509write_crt_set_authority_key_identifier returned -0x%02x - %s\n\n", -ret, buf );
|
2013-09-06 19:27:21 +02:00
|
|
|
goto exit;
|
|
|
|
}
|
|
|
|
|
2015-04-08 12:49:31 +02:00
|
|
|
mbedtls_printf( " ok\n" );
|
|
|
|
#endif /* MBEDTLS_SHA1_C */
|
2013-09-06 19:27:21 +02:00
|
|
|
|
2013-09-09 12:37:54 +02:00
|
|
|
if( opt.key_usage )
|
|
|
|
{
|
2015-04-08 12:49:31 +02:00
|
|
|
mbedtls_printf( " . Adding the Key Usage extension ..." );
|
2013-09-09 12:37:54 +02:00
|
|
|
fflush( stdout );
|
|
|
|
|
2015-04-08 12:49:31 +02:00
|
|
|
ret = mbedtls_x509write_crt_set_key_usage( &crt, opt.key_usage );
|
2013-09-09 12:37:54 +02:00
|
|
|
if( ret != 0 )
|
|
|
|
{
|
2015-04-08 12:49:31 +02:00
|
|
|
mbedtls_strerror( ret, buf, 1024 );
|
|
|
|
mbedtls_printf( " failed\n ! mbedtls_x509write_crt_set_key_usage returned -0x%02x - %s\n\n", -ret, buf );
|
2013-09-09 12:37:54 +02:00
|
|
|
goto exit;
|
|
|
|
}
|
|
|
|
|
2015-04-08 12:49:31 +02:00
|
|
|
mbedtls_printf( " ok\n" );
|
2013-09-09 12:37:54 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
if( opt.ns_cert_type )
|
|
|
|
{
|
2015-04-08 12:49:31 +02:00
|
|
|
mbedtls_printf( " . Adding the NS Cert Type extension ..." );
|
2013-09-09 12:37:54 +02:00
|
|
|
fflush( stdout );
|
|
|
|
|
2015-04-08 12:49:31 +02:00
|
|
|
ret = mbedtls_x509write_crt_set_ns_cert_type( &crt, opt.ns_cert_type );
|
2013-09-09 12:37:54 +02:00
|
|
|
if( ret != 0 )
|
|
|
|
{
|
2015-04-08 12:49:31 +02:00
|
|
|
mbedtls_strerror( ret, buf, 1024 );
|
|
|
|
mbedtls_printf( " failed\n ! mbedtls_x509write_crt_set_ns_cert_type returned -0x%02x - %s\n\n", -ret, buf );
|
2013-09-09 12:37:54 +02:00
|
|
|
goto exit;
|
|
|
|
}
|
|
|
|
|
2015-04-08 12:49:31 +02:00
|
|
|
mbedtls_printf( " ok\n" );
|
2013-09-09 12:37:54 +02:00
|
|
|
}
|
|
|
|
|
2013-09-06 09:55:26 +02:00
|
|
|
/*
|
|
|
|
* 1.2. Writing the request
|
|
|
|
*/
|
2015-04-08 12:49:31 +02:00
|
|
|
mbedtls_printf( " . Writing the certificate..." );
|
2013-09-06 09:55:26 +02:00
|
|
|
fflush( stdout );
|
|
|
|
|
2013-09-12 05:59:05 +02:00
|
|
|
if( ( ret = write_certificate( &crt, opt.output_file,
|
2015-04-08 12:49:31 +02:00
|
|
|
mbedtls_ctr_drbg_random, &ctr_drbg ) ) != 0 )
|
2013-09-06 09:55:26 +02:00
|
|
|
{
|
2015-04-08 12:49:31 +02:00
|
|
|
mbedtls_strerror( ret, buf, 1024 );
|
|
|
|
mbedtls_printf( " failed\n ! write_certifcate -0x%02x - %s\n\n", -ret, buf );
|
2013-09-06 09:55:26 +02:00
|
|
|
goto exit;
|
|
|
|
}
|
|
|
|
|
2015-04-08 12:49:31 +02:00
|
|
|
mbedtls_printf( " ok\n" );
|
2013-09-06 09:55:26 +02:00
|
|
|
|
|
|
|
exit:
|
2015-04-08 12:49:31 +02:00
|
|
|
mbedtls_x509write_crt_free( &crt );
|
|
|
|
mbedtls_pk_free( &loaded_subject_key );
|
|
|
|
mbedtls_pk_free( &loaded_issuer_key );
|
|
|
|
mbedtls_mpi_free( &serial );
|
|
|
|
mbedtls_ctr_drbg_free( &ctr_drbg );
|
|
|
|
mbedtls_entropy_free( &entropy );
|
2013-09-06 09:55:26 +02:00
|
|
|
|
|
|
|
#if defined(_WIN32)
|
2015-04-08 12:49:31 +02:00
|
|
|
mbedtls_printf( " + Press Enter to exit this program.\n" );
|
2013-09-06 09:55:26 +02:00
|
|
|
fflush( stdout ); getchar();
|
|
|
|
#endif
|
|
|
|
|
|
|
|
return( ret );
|
|
|
|
}
|
2015-04-08 12:49:31 +02:00
|
|
|
#endif /* MBEDTLS_X509_CRT_WRITE_C && MBEDTLS_X509_CRT_PARSE_C &&
|
|
|
|
MBEDTLS_FS_IO && MBEDTLS_ENTROPY_C && MBEDTLS_CTR_DRBG_C &&
|
|
|
|
MBEDTLS_ERROR_C */
|