Click here to Skip to main content
15,881,882 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I tried to use tls_config_set_ca_path
But seems libTLS is not using the files in the path set.

tls_config_set_ca_path is success. But when I use tls_write(), the below error is returned.
certificate verification failed: unable to get local issuer certificate


What I have tried:

When i use
tls_config_set_ca_file
using the same file it works perfectly.


But i need to use
tls_config_set_ca_path


[Edited to include comment response]
tls_init()
cfg = tls_config_new()
ls_config_set_ca_path(cfg, "/usr/local/etc/mycerts/CA-certificates")
tls_config_set_protocols(cfg, TLS_PROTOCOL_TLSv1_3)
ctx = tls_client()
tls_configure(ctx, cfg)
tls_connect_socket(ctx,readsoc, "abc")
tls_write(ctx, buf, buflen)
Posted
Updated 13-Aug-20 21:16pm
v4
Comments
Garth J Lancaster 14-Aug-20 2:38am    
can you use Use Improve question to update your question with your init code ? What is the return code from the tls_config_set_ca_path function ?
dilsdgr8 14-Aug-20 2:56am    
tls_init()
cfg = tls_config_new()
ls_config_set_ca_path(cfg, "/usr/local/etc/mycerts/CA-certificates")
tls_config_set_protocols(cfg, TLS_PROTOCOL_TLSv1_3)
ctx = tls_client()
tls_configure(ctx, cfg)
tls_connect_socket(ctx,readsoc, "abc")
tls_write(ctx, buf, buflen)
Garth J Lancaster 14-Aug-20 3:31am    
so what is the return code from the
tls_config_set_ca_path(cfg, "/usr/local/etc/mycerts/CA-certificates")
call, as in
int tcscp = tls_config_set_ca_path(cfg, "/usr/local/etc/mycerts/CA-certificates")
? my guess would be -1 ...
Stefan_Lang 14-Aug-20 3:34am    
I've never used these commands myself, but whenever I set a path with any function, I usually add a final '/'. Just a shot in the dark...

P.S.: didn't you forget a leading 't' in that call to tls_config_set_ca_path(), or is that a typo in your code?
Garth J Lancaster 14-Aug-20 4:02am    
I think that's a typo/cut&paste error Stefan - I left it as it was for the OP .. good call on the '/' at the end of the path though, I hope the OP sees it

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900