Skip to main content

NoCertificateVerification

Struct NoCertificateVerification 

Source
pub struct NoCertificateVerification;
Expand description

A dangerous implementation of ServerCertVerifier that accepts any certificate without validation.

⚠️ WARNING: This struct disables all TLS certificate verification checks. It should ONLY be used for development and testing purposes where you understand and accept the security implications.

§Example

use rustls::ClientConfig;
use rustls_dangerous::NoCertificateVerification;

let verifier = NoCertificateVerification;
let config = ClientConfig::builder()
    .dangerous()
    .with_custom_certificate_verifier(std::sync::Arc::new(verifier))
    .with_no_client_auth();

Trait Implementations§

Source§

impl Clone for NoCertificateVerification

Source§

fn clone(&self) -> NoCertificateVerification

Returns a duplicate of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for NoCertificateVerification

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl ServerCertVerifier for NoCertificateVerification

Source§

fn verify_server_cert( &self, _end_entity: &CertificateDer<'_>, _intermediates: &[CertificateDer<'_>], _server_name: &ServerName<'_>, _ocsp: &[u8], _now: UnixTime, ) -> Result<ServerCertVerified, Error>

Verifies the server certificate chain.

⚠️ DANGEROUS: This implementation always returns success without performing any certificate validation. It skips all security checks including:

  • Certificate chain validation
  • Hostname verification
  • Certificate expiration checks
  • Certificate revocation checks
  • Signature verification
§Arguments
  • _end_entity - The server’s end entity certificate (ignored)
  • _intermediates - The intermediate certificates in the chain (ignored)
  • _server_name - The server’s hostname (ignored)
  • _ocsp - OCSP response data (ignored)
  • _now - The current time (ignored)
Source§

fn verify_tls12_signature( &self, _msg: &[u8], _cert: &CertificateDer<'_>, _dss: &DigitallySignedStruct, ) -> Result<HandshakeSignatureValid, Error>

Verifies a TLS 1.2 handshake signature.

⚠️ DANGEROUS: This implementation always returns success without verifying the signature. This means:

  • Any message with any signature will be accepted
  • The signature is not cryptographically verified
  • An attacker could forge handshake messages
§Arguments
  • _msg - The message that was signed (ignored)
  • _cert - The certificate containing the public key (ignored)
  • _dss - The digitally signed struct containing the signature (ignored)
Source§

fn verify_tls13_signature( &self, _msg: &[u8], _cert: &CertificateDer<'_>, _dss: &DigitallySignedStruct, ) -> Result<HandshakeSignatureValid, Error>

Verifies a TLS 1.3 handshake signature.

⚠️ DANGEROUS: This implementation always returns success without verifying the signature. This means:

  • Any message with any signature will be accepted
  • The signature is not cryptographically verified
  • An attacker could forge handshake messages
§Arguments
  • _msg - The message that was signed (ignored)
  • _cert - The certificate containing the public key (ignored)
  • _dss - The digitally signed struct containing the signature (ignored)
Source§

fn supported_verify_schemes(&self) -> Vec<SignatureScheme>

Returns a comprehensive list of supported signature schemes.

This includes modern and legacy schemes for compatibility:

  • RSA PKCS#1 with SHA-1, SHA-256, SHA-384, SHA-512
  • ECDSA with NIST P-256, P-384, P-521
  • RSA-PSS with SHA-256, SHA-384, SHA-512
  • EdDSA (Ed25519, Ed448)
Source§

fn requires_raw_public_keys(&self) -> bool

Indicates whether raw public keys are required.

Returns false because certificate-based verification is used (though all checks are bypassed in this dangerous implementation).

Source§

fn root_hint_subjects(&self) -> Option<&[DistinguishedName]>

Returns hints about acceptable root certificate subjects.

Returns None because no certificate validation is performed in this dangerous implementation.

Source§

impl Copy for NoCertificateVerification

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.