Skip to main content

TimeStampResponse

Struct TimeStampResponse 

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

Wrapper around the response from a timestamp server, providing methods to access and verify the signed timestamp.

Right now, the timestamp response is only verified regarding the data it contains, not the signature itself. This might be added in the future.

Implementations§

Source§

impl TimeStampResponse

Source

pub fn new(data: Vec<u8>) -> Self

Creates a new TimeStampResponse from the provided DER encoded data.

  • data: The raw bytes (ASN.1 DER encoded) of the timestamp response.

There is no check done, whether the given data is actually a DER encoded timestamp response. In case of invalid data a call to the verify method will indicate an error then.

Source

pub fn as_der_encoded(&self) -> &[u8]

Returns the raw DER encoded data of the timestamp response.

This is the same data that was provided when creating the TimeStampResponse instance. Hence, to ensure that the data is valid, you should call the verify method before using this data.

Source

pub fn verify(&self, request: &TimeStampRequest) -> Result<(), Box<dyn Error>>

Verifies the timestamp response against the original timestamp request.

This includes checking the version, hash algorithm, and the message imprint to ensure they match the original data. This is not a complete check regarding the RFC 3161 standard, but it covers the most important aspects for basic usage.

Right now, the timestamp response is only verified regarding the data it contains, not the signature itself. This might be added in the future.

  • request: The original timestamp request that was sent to the server.
Source

pub fn datetime(&self) -> Result<DateTime<Utc>, Box<dyn Error>>

Extracts and returns the date and time of the timestamp.

The result is given in the UTC timezone as a chrono::DateTime<Utc>.

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.

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

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

Source§

fn vzip(self) -> V