-
Notifications
You must be signed in to change notification settings - Fork 22
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat: add Verifier::set_provider and Verifier::with_provider #81
Conversation
Thank you for picking this up! The general approach seems like the right solution. |
5f8d3bf
to
4063a23
Compare
67f8726
to
a1d7965
Compare
Hi Everyone! Thanks @jbr for picking this up so fast, I'm not sure what type of testing you have done but I tried to verify this on my end with a custom crypto provider but I am running into some issues. Here is the snippet of code that I am trying to get working.
And im getting the following error, what am I doing wrong here?
I've also noticed on the Please forgive my new-ness to rust but would this be the cause of the error? Or is there something wrong with the configuration on my end? Appreciate the help here! |
@nnmkhang It's still a PR let provider = Arc::new(default_symcrypt_provider());
ClientConfig::builder_with_provider(provider.clone())
.with_safe_default_protocol_versions()
.unwrap()
.dangerous()
.with_custom_certificate_verifier(Arc::new(Verifier::new().with_provider(provider)))
.with_no_client_auth() Note the The awkwardness of this construction motivates #86, which that code was directly taken from Alternatively, if you wanted to use let provider = Arc::new(default_symcrypt_provider());
let mut verifier = Verifier::new();
verifier.set_provider(provider.clone());
ClientConfig::builder_with_provider(provider)
.with_safe_default_protocol_versions()
.unwrap()
.dangerous()
.with_custom_certificate_verifier(Arc::new(verifier))
.with_no_client_auth() |
864067f
to
e885f64
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for working through this with us! I think this is looking quite nice now.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Really nice! Thanks again.
e885f64
to
b2078a7
Compare
b2078a7
to
bf8ca6e
Compare
@jbr, Just tried it again on my my machine and it works with the custom provider and the platform verifier enabled! Verified with event viewer on windows as well. Thanks for your help and sorry for my silly mistake. |
Sounds good to me. |
v/0.3.1 is now available with this change included. |
This is offered as a possible solution for #79, which I just encountered.
Implementation notes, let me know if any of these assumptions were wrong:
default_provider
fields tocrypto_provider
to make clear that it's not necessarily the process-default.set_provider
andwith_provider
, the latter of which is convenient forVerifier::new().with_provider(Arc::new(...))
but I'll replace withVerifier::new_with_provider(...)
if that's more in line with this crate's style.I opted to panic if the crypto provider has already been set instead of returning an indication of failure, with the expectation that it's a bug if this is called multiple times on a givenWe haveVerifier
.&mut
, no panic or error needed