Skip to main content

Claimed

Struct Claimed 

Source
pub struct Claimed<I: Identity> { /* private fields */ }
Expand description

A chain whose peer has claimed a static — §6.1’s stage 1, at 1 DH cumulative.

The claim is not proof. Drop is a silent reject.

S8 — #[must_use], see Intro. This is the stage S8 names explicitly, the one parked across turns while a human is asked.

Implementations§

Source§

impl<I: Identity> Claimed<I>

Source

pub fn claimed_static(&self) -> &PublicKeyOf<I>

The static the peer claims.

Named claimed_static, never remote_static, and the name is the documentation: at this stage possession has not been proven. §6.1’s ss in authenticate is what proves it.

Source

pub async fn authenticate(self) -> Result<Proven<I>, AuthError>
where I::Suite: Handshake<Psk = ()>,

§6.1’s stage 2 — +1 DH (ss), 2 cumulative.

Possession is proven here, and §17.1’s timestamp guard admits the initiation here. On any error the chain is discarded, for the reason given on Intro::read_identity.

Cancel-safe on the same terms as Intro::read_identity: a dropped future rejects the chain rather than orphaning it.

Defined only where the suite’s pattern has no pre-shared key; a channel_psk! suite has authenticate_with instead.

Source

pub async fn authenticate_with( self, psk: PskOf<I>, ) -> Result<Proven<I>, AuthError>

authenticate, naming the pre-shared key.

§This is the stage the PSK belongs at, and the reason is the cost

claimed_static is already in your hand — one es, and nothing else, has been spent — so the key is selected with the peer named. That ordering is the whole reason the pattern is IKpsk1 and not a psk0 shape: its psk token sits after msg1’s s, so a stranger you have no key for is rejected by dropping this object, at 1 DH. Choosing inside the handshake instead — hiss’s read_message_1_with lookup closure, which fires at the psk token and therefore after the proving ss — would cost 2 (ruling 280).

This is also why the key is not held by the endpoint: an endpoint that already knew which PSK to use would have no use for the identity this stage exists to reveal.

§A wrong key is AuthError::HandshakeFailed

The same undetailed verdict a forged identity gets, and the same 2 DH. “You are not who you claim” and “you do not hold the pairing secret” are one answer to one question, and §18.1 gives an unauthenticated peer no oracle for telling them apart.

Cancel-safe on the same terms as authenticate.

Trait Implementations§

Source§

impl<I: Identity> Debug for Claimed<I>

Source§

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

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

impl<I: Identity> Drop for Claimed<I>

Source§

fn drop(&mut self)

Executes the destructor for this type. Read more
Source§

fn pin_drop(self: Pin<&mut Self>)

🔬This is a nightly-only experimental API. (pin_ergonomics)
Execute the destructor for this type, but different to Drop::drop, it requires self to be pinned. Read more

Auto Trait Implementations§

§

impl<I> !RefUnwindSafe for Claimed<I>

§

impl<I> !Send for Claimed<I>

§

impl<I> !Sync for Claimed<I>

§

impl<I> !UnwindSafe for Claimed<I>

§

impl<I> Freeze for Claimed<I>
where Shell<I>: Freeze, <<<I as Identity>::Suite as Channel>::Curve as Curve>::PublicKey: Freeze,

§

impl<I> Unpin for Claimed<I>
where Shell<I>: Unpin, <<<I as Identity>::Suite as Channel>::Curve as Curve>::PublicKey: Unpin,

§

impl<I> UnsafeUnpin for Claimed<I>
where Shell<I>: UnsafeUnpin, <<<I as Identity>::Suite as Channel>::Curve as Curve>::PublicKey: UnsafeUnpin,

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<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self> ⓘ

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self> ⓘ

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
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<P> ProviderExt for P

Source§

fn generate<C>( &mut self, ) -> Result<<P as CryptoKeyProvider<C>>::PrivateKey, <P as CryptoKeyProvider<C>>::Error>
where C: Curve, P: CryptoKeyProvider<C>,

Generate a long-term static key for curve C.
Source§

fn generate_ephemeral<C>( &mut self, ) -> Result<<P as CryptoKeyProvider<C>>::PrivateKey, <P as CryptoKeyProvider<C>>::Error>
where C: Curve, P: CryptoKeyProvider<C>,

Generate an ephemeral key for curve C.
Source§

fn public<K>( &self, key: &K, ) -> Result<<<K as SecretKey>::Curve as Curve>::PublicKey, <P as CryptoKeyProvider<<K as SecretKey>::Curve>>::Error>
where K: SecretKey, P: CryptoKeyProvider<<K as SecretKey>::Curve, PrivateKey = K>,

Extract the public key, inferring the curve from key.
Source§

impl<T> Read<Exclusive, BecauseExclusive> for T
where T: ?Sized,

Source§

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

Source§

type Error = !

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

fn try_from(value: U) -> Result<T, !>

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.
Source§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

Source§

fn vzip(self) -> V

Source§

impl<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self> ⓘ
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self> ⓘ

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more