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
impl TimeStampResponse
Sourcepub fn new(data: Vec<u8>) -> Self
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.
Sourcepub fn as_der_encoded(&self) -> &[u8] ⓘ
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.
Sourcepub fn verify(&self, request: &TimeStampRequest) -> Result<(), Box<dyn Error>>
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.