CaState

Struct CaState 

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

The stateless CA processor.

Holds in-flight request state and the signing identity. All methods take &self and are safe to call from concurrent tasks.

Implementations§

Source§

impl CaState

Source

pub fn new(config: CaConfig, manager: Arc<SecurityManager>) -> Self

Source

pub fn cleanup_expired(&self, ttl_secs: u64)

Remove pending requests older than ttl_secs.

Called lazily from [handle_new] to amortize cleanup cost. Per NDNCERT 0.3, the NEW→CHALLENGE window is 60 seconds.

Source

pub fn is_revoked(&self, cert_name: &str) -> bool

Check whether a certificate name has been revoked.

Source

pub fn handle_info(&self) -> Vec<u8>

Handle a CA INFO request — return the CA’s profile as TLV.

Source

pub fn handle_probe(&self, requested_name: &str) -> Vec<u8>

Handle a PROBE request — check namespace policy without creating state.

Route: /<ca-prefix>/CA/PROBE; requested name in ApplicationParameters. Returns TLV-encoded ProbeResponseTlv.

Source

pub async fn handle_new(&self, body: &[u8]) -> Result<Vec<u8>, CertError>

Handle a NEW request — validate, perform ECDH, store state, return challenges.

Body: TLV-encoded NewRequestTlv (ECDH pub key + cert request bytes). Returns: TLV-encoded NewResponseTlv (CA ECDH pub key + salt + request_id + challenges).

Source

pub async fn handle_challenge( &self, request_id: &str, body: &[u8], ) -> Result<Vec<u8>, CertError>

Handle a CHALLENGE request — decrypt parameters, verify, issue or deny.

Body: TLV-encoded [ChallengeRequestTlv] (encrypted challenge parameters). Returns: TLV-encoded ChallengeResponseTlv.

Source

pub async fn handle_revoke(&self, body: &[u8]) -> Vec<u8>

Handle a REVOKE request.

Route: /<ca-prefix>/CA/REVOKE; body is TLV-encoded RevokeRequestTlv. Returns TLV-encoded RevokeResponseTlv.

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

Source§

fn from(t: T) -> T

Returns the argument unchanged.

§

impl<T> Instrument for T

§

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

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

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.

§

impl<T> Pointable for T

§

const ALIGN: usize

The alignment of pointer.
§

type Init = T

The type for initializers.
§

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
§

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
§

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. Read more
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.
§

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

§

fn vzip(self) -> V

§

impl<T> WithSubscriber for T

§

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
§

fn with_current_subscriber(self) -> WithDispatch<Self>

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