-
Notifications
You must be signed in to change notification settings - Fork 2.8k
Description
Summary
I see there is one function write_certitifcate_request() inside main() present in this file mbedtls/programs/x509/cert_req.c for generating certificate signing request.
I tried the same from my main(), it doesn’t work for me. It fails in write_certificate_request function.
Do you have any sample keys with which you have tested the code present in this file cert_req.c file and it worked for you?
System information
Mbed TLS version (number or commit id): 3.3.0
Operating system and version: Ubuntu 20.04
Configuration (if not default, please attach mbedtls_config.h): Enabled, MBEDTLS_X509_CSR_WRITE_C, MBEDTLS_X509_CREATE_C, MBEDTLS_PK_WRITE_C, MBEDTLS_ECP_C, MBEDTLS_ECDSA_C, MBEDTLS_ECP_RESTARTABLE, MBEDTLS_PLATFORM_MEMORY, MBEDTLS_MEMORY_BUFFER_ALLOC_C, MBEDTLS_ECDH_LEGACY_CONTEXT, MBEDTLS_ECP_DP_SECP384R1_ENABLED, MBEDTLS_ALLOW_PRIVATE_ACCESS, MBEDTLS_ASN1_WRITE_C, MBEDTLS_PEM_PARSE_C, MBEDTLS_BASE64_C, MBEDTLS_ECP_SHORT_WEIERSTRASS_ENABLED, MBEDTLS_PEM_WRITE_C, MBEDTLS_ENTROPY_C
Compiler and options (if you used a pre-built binary, please indicate how you obtained it): gcc
Additional environment information:
Expected behavior
write_certitifcate_request should return 0 on success.
Actual behavior
write_certitifcate_request return non zero.
Steps to reproduce
Used the below EC SEC384 key and executed the steps present in main() present in cert_req.c file.
Additional information
#define TEST1_SRV1_KEY1_EC1_PEM1
"-----BEGIN EC PRIVATE KEY-----\r\n"
"MHcCAQEEIPb3hmTxZ3/mZI3vyk7p3U3wBf+WIop6hDhkFzJhmLcqoAoGCCqGSM49\r\n"
"AwEHoUQDQgAEV+WusXPf06y7k7iB/xKu7uZTrM5VU/Y0Dswu42MlC9+Y4vNcYDaW\r\n"
"wNUYFHDlf5/VS0UY5bBs1Vz4lo+HcKPkxw==\r\n"
"-----END EC PRIVATE KEY-----\r\n"
const char prikey1[] = TEST1_SRV1_KEY1_EC1_PEM1;