How can I add a certificate to the trusted root certification authorities?


I would like to add a certificate to my service certificate store, in the trusted root certification authorities. How is it possible programmatically, with rust ? I already know openssl, but can’t find if there is a way to do that.


This is highly platform- and even distribution-dependent for Linux—certificate store location is not standardized. I’m not aware of any cross-platform crate for cert manipulation. You should probably shell out to an existing system utility for this.

(Some time ago I wrote a mini-crate which could enumerate/load CA certificates from the system store on all major platforms. It was part of rustup for a while, before ditching rustls support made it redundant. It’s in the repo up to commit 27fccd35, under src/ca-loader. I know it’s not an answer to your problem, but I’m mentioning it as an illustration of what’s needed to work with certificate across multiple platforms.)


Thanks for your answer. You’re right, I should have specify it, I want to do it for windows for now.