Struct IasHandle

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

Represents a handle to Intel’s Attestation Service. It allows the user to perform operations such as getting a SigRL for a specified GroupId, or verifying a specified quote with the IAS.

Implementations§

Source§

impl IasHandle

Source

pub fn new( api_key: &str, verify_url: Option<&str>, sigrl_url: Option<&str>, ) -> Result<Self>

Create new instance with the specified api_key API key, IAS verification URL verify_url, and IAS SigRL URL sigrl_url.

By default, the following URLs are used:

§Errors

This function will fail with Error::IasInitNullPtr if initialisation of the handle is unsuccessful, or if converting input arguments to CString fails.

§Examples
let _handle = IasHandle::new("012345abcdef", None, None)?;
Source

pub fn get_sigrl(&self, group_id: &GroupId) -> Result<Option<Sigrl>>

Obtain SigRL for the given group_id.

§Errors

This function will fail with Error::IasGetSigrlNonZero(_) if the group_id is invalid, or the IasHandle was created with an invalid IAS verification URL.

§Examples
use std::str::FromStr;
let handle = IasHandle::new("012345abcdef", None, None)?;
let group_id = GroupId::from_str("01234567")?;
let res = handle.get_sigrl(&group_id);
assert!(res.is_err());
Source

pub fn verify_quote( &self, quote: &Quote, nonce: Option<&Nonce>, report_path: Option<&Path>, sig_path: Option<&Path>, cert_path: Option<&Path>, advisory_path: Option<&Path>, ) -> Result<()>

Verify provided quote.

§Errors

This function will fail with Error::IasVerifyQuoteNonZero(_) if the provided quote is invalid, or the nonce, or if the IAS server returns a non 200 status code.

§Examples
let handle = IasHandle::new("012345abcdef", None, None)?;
let quote = Quote::from(vec![0u8; 100]);
let res = handle.verify_quote(&quote, None, None, None, None, None);
assert!(res.is_err());

Trait Implementations§

Source§

impl Drop for IasHandle

Source§

fn drop(&mut self)

Executes the destructor for this type. Read more

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