Giter VIP home page Giter VIP logo

Comments (6)

pranaw215 avatar pranaw215 commented on June 15, 2024 2

Thanks cpu , Its working . I have added the crl support at client side also in custom_verifier below to check the revocation status of server cert chain.

let custom_verifier =
    WebPkiServerVerifier::builder_with_provider(server_auth_root.into(), provider.clone())
        **.with_crls(crls.clone())**
        .build()
        .unwrap();

let config = rustls::ClientConfig::builder_with_provider(provider)
    .with_protocol_versions(&[&rustls::version::TLS13])
    .unwrap()
    .with_webpki_verifier(custom_verifier)
    .with_no_client_auth();

from rustls.

djc avatar djc commented on June 15, 2024 1

@pranaw215 you can use the custom provider for both -- it's just that you weren't customizing the CryptoProvider used for the ClientConfig (directly) previously which would cause this issue.

from rustls.

cpu avatar cpu commented on June 15, 2024

Hi there,

I have configured the cipher suites using below code.
let builder = WebPkiServerVerifier::builder_with_provider(...

The crypto provider used by the WebPkiServerVerifier is not the one that determines the ciphersuites offered in the client hello of a TLS handshake. The verifier's crypto provider cipher_suites are specific to validating the signatures of presented certificate chains. Edit: Sorry, misspoke. This field would be ignored by the verifier, I was thinking of the signature_verification_algorithms.

Try using ClientConfig::builder_with_provider to ensure that the ClientConfig uses the same customized crypto provider. There's a complete example of doing this in limitedclient.rs if that's helpful.

from rustls.

pranaw215 avatar pranaw215 commented on June 15, 2024

Hi there,

I have configured the cipher suites using below code.
let builder = WebPkiServerVerifier::builder_with_provider(...

The crypto provider used by the WebPkiServerVerifier is not the one that determines the ciphersuites offered in the client hello of a TLS handshake. The verifier's crypto provider cipher_suites are specific to validating the signatures of presented certificate chains. Edit: Sorry, misspoke. This field would be ignored by the verifier, I was thinking of the signature_verification_algorithms.

Try using ClientConfig::builder_with_provider to ensure that the ClientConfig uses the same customized crypto provider. There's a complete example of doing this in limitedclient.rs if that's helpful.

Hi ,

I used [ClientConfig::builder_with_provider] and the configured cipher is working there , But I want the CRL support also.
Can you please point the example where CRL support is also there in the example.

from rustls.

cpu avatar cpu commented on June 15, 2024

Can you please point the example where CRL support is also there in the example.

We only have an example using CRLs for verifying client certificates as a server. It looks like you're trying to do the inverse and have a client check revocation status for the server.

Something like this diff to limitedclient.rs should be a good starting point for using a custom provider for both the client config and the verifier:

diff --git a/examples/src/bin/limitedclient.rs b/examples/src/bin/limitedclient.rs
index 62443cae..fcaeafa3 100644
--- a/examples/src/bin/limitedclient.rs
+++ b/examples/src/bin/limitedclient.rs
@@ -2,6 +2,7 @@
 //! so that unused cryptography in rustls can be discarded by the linker.  You can
 //! observe using `nm` that the binary of this program does not contain any AES code.

+use rustls::client::WebPkiServerVerifier;
 use std::io::{stdout, Read, Write};
 use std::net::TcpStream;
 use std::sync::Arc;
@@ -15,18 +16,22 @@ fn main() {
             .cloned(),
     );

-    let config = rustls::ClientConfig::builder_with_provider(
-        CryptoProvider {
-            cipher_suites: vec![provider::cipher_suite::TLS13_CHACHA20_POLY1305_SHA256],
-            kx_groups: vec![provider::kx_group::X25519],
-            ..provider::default_provider()
-        }
-        .into(),
-    )
-    .with_protocol_versions(&[&rustls::version::TLS13])
-    .unwrap()
-    .with_root_certificates(root_store)
-    .with_no_client_auth();
+    let provider = Arc::new(CryptoProvider {
+        cipher_suites: vec![provider::cipher_suite::TLS13_CHACHA20_POLY1305_SHA256],
+        kx_groups: vec![provider::kx_group::X25519],
+        ..provider::default_provider()
+    });
+
+    let custom_verifier =
+        WebPkiServerVerifier::builder_with_provider(root_store.into(), provider.clone())
+            .build()
+            .unwrap();
+
+    let config = rustls::ClientConfig::builder_with_provider(provider)
+        .with_protocol_versions(&[&rustls::version::TLS13])
+        .unwrap()
+        .with_webpki_verifier(custom_verifier)
+        .with_no_client_auth();

     let server_name = "www.rust-lang.org".try_into().unwrap();
     let mut conn = rustls::ClientConnection::new(Arc::new(config), server_name).unwrap();

from rustls.

cpu avatar cpu commented on June 15, 2024

I'm going to close this since we've figured out the problem causing the unexpected cipher suites in the hello. If you have any further questions feel free to comment or open a new issue.

Thanks!

from rustls.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.