[−][src]Struct tss_esapi::abstraction::transient::TransientObjectContext
Structure offering an abstracted programming experience.
The TransientObjectContext makes use of a root key from which the other, client-controlled
keyes are derived.
Currently, only functionality necessary for RSA key creation and usage (for signing and verifying signatures) is implemented.
Methods
impl TransientObjectContext[src]
pub unsafe fn new(
tcti: Tcti,
root_key_size: usize,
root_key_auth_size: usize,
owner_hierarchy_auth: &[u8]
) -> Result<Self>[src]
tcti: Tcti,
root_key_size: usize,
root_key_auth_size: usize,
owner_hierarchy_auth: &[u8]
) -> Result<Self>
Create a new TransientObjectContext.
The root key is created as a primary key in the Owner hierarchy and thus authentication is needed for the hierarchy. The authentication value is generated by the TPM itself, with a length provided as a parameter, and never exposed outside the context.
Safety
- it is the responsibility of the client to ensure that the context can be initialized safely, threading-wise
Constraints
root_key_sizemust be 1024 or 2048root_key_auth_sizemust be at most 32
Errors
- errors are returned if any method calls return an error:
Context::get_random,Context::start_auth_session,Context::create_primary_key,Context::flush_context,Context::set_handle_auth - if the root key authentication size is given greater than 32 or if the root key size is
not 1024 or 2048, a
WrongParamSizewrapper error is returned
pub fn create_rsa_signing_key(
&mut self,
key_size: usize,
auth_size: usize
) -> Result<(TpmsContext, Vec<u8>)>[src]
&mut self,
key_size: usize,
auth_size: usize
) -> Result<(TpmsContext, Vec<u8>)>
Create a new RSA signing key.
The key is created with most parameters defaulted as described for the get_rsa_public
method. The authentication value is generated by the TPM and returned along with the key
context.
Constraints
key_sizemust be 1024 or 2048auth_sizemust be at most 32
Errors
- if the authentication size is given larger than 32 or if the requested key size is not
1024 or 2048, a
WrongParamSizewrapper error is returned - errors are returned if any method calls return an error:
Context::get_random,TransientObjectContext::set_session_attrs,Context::create_key,Context::load,Context::context_save,Context::context_flush
pub fn load_external_rsa_public_key(
&mut self,
public_key: &[u8]
) -> Result<TpmsContext>[src]
&mut self,
public_key: &[u8]
) -> Result<TpmsContext>
Load a previously generated RSA public key.
Returns the key context.
Constraints
public_keymust be 128 or 256 elements long
Errors
- if the public key length is different than 1024 or 2048 bits, a
WrongParamSizewrapper error is returned - errors are returned if any method calls return an error:
TransientObjectContext::set_session_attrs,Context::load_external_public,Context::context_save,Context::flush_context`
pub fn read_public_key(&mut self, key_context: TpmsContext) -> Result<Vec<u8>>[src]
Read the public part from a previously generated key.
The method takes the key as a parameter and returns its public part.
Errors
- errors are returned if any method calls return an error:
Context::context_load,Context::read_public,Context::flush_context,TransientObjectContext::set_session_attrs
pub fn sign(
&mut self,
key_context: TpmsContext,
key_auth: &[u8],
digest: &[u8]
) -> Result<Signature>[src]
&mut self,
key_context: TpmsContext,
key_auth: &[u8],
digest: &[u8]
) -> Result<Signature>
Sign a digest with an existing key.
Takes the key as a parameter, signs and returns the signature.
Errors
- errors are returned if any method calls return an error:
Context::context_load,Context::sign,Context::flush_context,TransientObjectContext::set_session_attrsContext::set_handle_auth
pub fn verify_signature(
&mut self,
key_context: TpmsContext,
digest: &[u8],
signature: Signature
) -> Result<TpmtTkVerified>[src]
&mut self,
key_context: TpmsContext,
digest: &[u8],
signature: Signature
) -> Result<TpmtTkVerified>
Verify a signature against a digest.
Given a digest, a key and a signature, this method returns a Verified ticket if the
verification was successful.
Errors
- if the verification fails (i.e. the signature is invalid), a TPM error is returned
- errors are returned if any method calls return an error:
Context::context_load,Context::verify_signature,Context::flush_context,TransientObjectContext::set_session_attrs
Trait Implementations
Auto Trait Implementations
impl RefUnwindSafe for TransientObjectContext
impl Send for TransientObjectContext
impl Sync for TransientObjectContext
impl Unpin for TransientObjectContext
impl UnwindSafe for TransientObjectContext
Blanket Implementations
impl<T> Any for T where
T: 'static + ?Sized, [src]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized, [src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized, [src]
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T[src]
impl<T> Free for T[src]
impl<T> From<T> for T[src]
impl<T, U> Into<U> for T where
U: From<T>, [src]
U: From<T>,
impl<T, U> TryFrom<U> for T where
U: Into<T>, [src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>, [src]
U: TryFrom<T>,