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
impl IasHandle
Sourcepub fn new(
api_key: &str,
verify_url: Option<&str>,
sigrl_url: Option<&str>,
) -> Result<Self>
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:
- IAS verification - dev/attestation/v3/report
- IAS SigRL - dev/attestation/v3/sigrl
§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)?;
Sourcepub fn get_sigrl(&self, group_id: &GroupId) -> Result<Option<Sigrl>>
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());
Sourcepub 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<()>
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("e, None, None, None, None, None);
assert!(res.is_err());