OscoreEdhocHandler

Struct OscoreEdhocHandler 

Source
pub struct OscoreEdhocHandler<H: Handler, Crypto: Crypto, CryptoFactory: Fn() -> Crypto, SSC: ServerSecurityConfig, RNG: RngCore + CryptoRng, TP: TimeProvider> { /* private fields */ }
Expand description

A CoAP handler wrapping inner resources, and adding EDHOC, OSCORE and ACE support.

While the ACE (authz-info) and EDHOC parts could be implemented as a handler that is to be added into the tree, the OSCORE part needs to wrap the inner handler anyway, and EDHOC and OSCORE are intertwined rather strongly in processing the EDHOC option.

Implementations§

Source§

impl<H: Handler, Crypto: Crypto, CryptoFactory: Fn() -> Crypto, SSC: ServerSecurityConfig, RNG: RngCore + CryptoRng, TP: TimeProvider> OscoreEdhocHandler<H, Crypto, CryptoFactory, SSC, RNG, TP>

Source

pub fn new( inner: H, authorities: SSC, crypto_factory: CryptoFactory, rng: RNG, time: TP, ) -> Self

Creates a new CoAP server implementation (a [Handler][coap_handler::Handler]), wrapping an inner (application) handler.

The main configuration is passed in as authorities; the seccfg module has suitable implementations.

The time provider is used to evaluate any time limited tokens leniently; choosing a “bad” time source here (in particular crate::time::TimeUnknown) leads to acceptance of expired tokens.

rng and crypto_factory are used to pass in platform specific implementations of what may be accelerated by hardware or reuse operating system infrastructure. Any CSPRNG is suitable for rng (Ariel OS picks rand_chacha::ChaCha20Rng at the time of writing); the crypto factory can come from the lakers_crypto_rustcrypto::Crypto or any more specialized hardware based implementation.

Trait Implementations§

Source§

impl<H: Handler, Crypto: Crypto, CryptoFactory: Fn() -> Crypto, SSC: ServerSecurityConfig, RNG: RngCore + CryptoRng, TP: TimeProvider> Handler for OscoreEdhocHandler<H, Crypto, CryptoFactory, SSC, RNG, TP>

Source§

type RequestData = OrInner<OwnRequestData<Result<<H as Handler>::RequestData, <H as Handler>::ExtractRequestError>>, AuthorizationChecked<<H as Handler>::RequestData>>

Type constructed in extract_request_data() passed on to build_response(). Read more
Source§

type ExtractRequestError = OrInner<Error, <H as Handler>::ExtractRequestError>

Source§

type BuildResponseError<M: MinimalWritableMessage> = OrInner<Result<Error, <M as MinimalWritableMessage>::UnionError>, <H as Handler>::BuildResponseError<M>>

Source§

fn extract_request_data<M: ReadableMessage>( &mut self, request: &M, ) -> Result<Self::RequestData, Self::ExtractRequestError>

Process an incoming request. Read more
Source§

fn estimate_length(&mut self, req: &Self::RequestData) -> usize

Estimate an upper bound for the number of bytes in the response Read more
Source§

fn build_response<M: MutableWritableMessage>( &mut self, response: &mut M, req: Self::RequestData, ) -> Result<(), Self::BuildResponseError<M>>

Build a response for the request Read more

Auto Trait Implementations§

§

impl<H, Crypto, CryptoFactory, SSC, RNG, TP> Freeze for OscoreEdhocHandler<H, Crypto, CryptoFactory, SSC, RNG, TP>
where SSC: Freeze, H: Freeze, TP: Freeze, CryptoFactory: Freeze, RNG: Freeze, <SSC as ServerSecurityConfig>::GeneralClaims: Freeze, Crypto: Freeze,

§

impl<H, Crypto, CryptoFactory, SSC, RNG, TP> RefUnwindSafe for OscoreEdhocHandler<H, Crypto, CryptoFactory, SSC, RNG, TP>

§

impl<H, Crypto, CryptoFactory, SSC, RNG, TP> !Send for OscoreEdhocHandler<H, Crypto, CryptoFactory, SSC, RNG, TP>

§

impl<H, Crypto, CryptoFactory, SSC, RNG, TP> !Sync for OscoreEdhocHandler<H, Crypto, CryptoFactory, SSC, RNG, TP>

§

impl<H, Crypto, CryptoFactory, SSC, RNG, TP> Unpin for OscoreEdhocHandler<H, Crypto, CryptoFactory, SSC, RNG, TP>
where SSC: Unpin, H: Unpin, TP: Unpin, CryptoFactory: Unpin, RNG: Unpin, <SSC as ServerSecurityConfig>::GeneralClaims: Unpin, Crypto: Unpin,

§

impl<H, Crypto, CryptoFactory, SSC, RNG, TP> UnwindSafe for OscoreEdhocHandler<H, Crypto, CryptoFactory, SSC, RNG, TP>
where SSC: UnwindSafe, H: UnwindSafe, TP: UnwindSafe, CryptoFactory: UnwindSafe, RNG: UnwindSafe, <SSC as ServerSecurityConfig>::GeneralClaims: UnwindSafe, Crypto: UnwindSafe,

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