Skip to main content

DigServerCertVerifier

Struct DigServerCertVerifier 

Source
pub struct DigServerCertVerifier { /* private fields */ }
Expand description

Client-side verifier: verifies the SERVER’s leaf, pins its peer_id, and checks the BLS binding.

Two modes, selected at construction:

  • Self::new (default) additionally requires the leaf to chain to the shipped DigNetwork CA — the trust-DOMAIN marker for a fully-migrated DIG network.
  • Self::new_spki_pinned DROPS that CA-chain requirement (see the type-level note on require_ca_chain) while keeping every real authentication check. Used because live DIG peers present self-signed / chia-ssl leaves today (#1378 CA-everywhere migration deferred), so the CA-requiring path rejects every legit peer with UnknownIssuer (#1422).

Implementations§

Source§

impl DigServerCertVerifier

Source

pub fn new( expected: Option<PeerId>, captured: CapturedPeerId, binding_policy: BindingPolicy, captured_bls: CapturedBlsPub, ) -> Self

Build a verifier that REQUIRES the server leaf to chain to the DigNetwork CA, pins expected (or accepts any such peer when None), captures the derived id + BLS pubkey, and applies binding_policy.

Source

pub fn new_spki_pinned( expected: Option<PeerId>, captured: CapturedPeerId, binding_policy: BindingPolicy, captured_bls: CapturedBlsPub, ) -> Self

Build a SPKI-PINNED verifier: identical to Self::new except it does NOT require the server leaf to chain to the DigNetwork CA. Authentication still rests on the peer_id pin + rustls proof-of-possession + the #1204 BLS binding (see require_ca_chain). Use this to dial the self-signed peers on the live network (#1422); the CA-requiring Self::new stays for the deferred #1378 DIG-CA-everywhere migration.

SAFETY / USAGE CONTRACT: Unlike CA mode (where accept-any at least enforces the DIG trust domain), SPKI-pinned mode drops the CA check, so passing expected: None together with a non-Required BindingPolicy authenticates NOTHING about which peer answered — any peer presenting any self-signed leaf is accepted, and an active MITM is undetectable. A dialer MUST pass expected: Some(peer_id) (or use BindingPolicy::Required) to authenticate the specific peer. See #1422 / #1371.

Trait Implementations§

Source§

impl Debug for DigServerCertVerifier

Source§

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

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

impl ServerCertVerifier for DigServerCertVerifier

Source§

fn verify_server_cert( &self, end_entity: &CertificateDer<'_>, intermediates: &[CertificateDer<'_>], _server_name: &ServerName<'_>, _ocsp_response: &[u8], now: UnixTime, ) -> Result<ServerCertVerified, TlsError>

Verify the end-entity certificate end_entity is valid for the hostname dns_name and chains to at least one trust anchor. Read more
Source§

fn verify_tls12_signature( &self, message: &[u8], cert: &CertificateDer<'_>, dss: &DigitallySignedStruct, ) -> Result<HandshakeSignatureValid, TlsError>

Verify a signature allegedly by the given server certificate. Read more
Source§

fn verify_tls13_signature( &self, message: &[u8], cert: &CertificateDer<'_>, dss: &DigitallySignedStruct, ) -> Result<HandshakeSignatureValid, TlsError>

Verify a signature allegedly by the given server certificate. Read more
Source§

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

Return the list of SignatureSchemes that this verifier will handle, in verify_tls12_signature and verify_tls13_signature calls. Read more
Source§

fn requires_raw_public_keys(&self) -> bool

Returns whether this verifier requires raw public keys as defined in RFC 7250.
Source§

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

Return the DistinguishedNames of certificate authorities that this verifier trusts. Read more

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<'a, T, E> AsTaggedExplicit<'a, E> for T
where T: 'a,

Source§

fn explicit(self, class: Class, tag: u32) -> TaggedParser<'a, Explicit, Self, E>

Source§

impl<'a, T, E> AsTaggedImplicit<'a, E> for T
where T: 'a,

Source§

fn implicit( self, class: Class, constructed: bool, tag: u32, ) -> TaggedParser<'a, Implicit, Self, E>

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> 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> Same for T

Source§

type Output = T

Should always be Self
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.