Trait parsec_service::providers::Provide
source · pub trait Provide {
Show 30 methods
// Required methods
fn describe(&self) -> Result<(ProviderInfo, HashSet<Opcode>)>;
fn list_keys(
&self,
_application_identity: &ApplicationIdentity,
_op: Operation
) -> Result<Result>;
fn list_clients(&self, _op: Operation) -> Result<Result>;
// Provided methods
fn list_providers(&self, _op: Operation) -> Result<Result> { ... }
fn list_opcodes(&self, _op: Operation) -> Result<Result> { ... }
fn list_authenticators(&self, _op: Operation) -> Result<Result> { ... }
fn delete_client(
&self,
_application_identity: &ApplicationIdentity,
_op: Operation
) -> Result<Result> { ... }
fn ping(&self, _op: Operation) -> Result<Result> { ... }
fn psa_generate_key(
&self,
_application_identity: &ApplicationIdentity,
_op: Operation
) -> Result<Result> { ... }
fn psa_import_key(
&self,
_application_identity: &ApplicationIdentity,
_op: Operation
) -> Result<Result> { ... }
fn psa_export_public_key(
&self,
_application_identity: &ApplicationIdentity,
_op: Operation
) -> Result<Result> { ... }
fn psa_export_key(
&self,
_application_identity: &ApplicationIdentity,
_op: Operation
) -> Result<Result> { ... }
fn psa_destroy_key(
&self,
_application_identity: &ApplicationIdentity,
_op: Operation
) -> Result<Result> { ... }
fn psa_sign_hash(
&self,
_application_identity: &ApplicationIdentity,
_op: Operation
) -> Result<Result> { ... }
fn psa_verify_hash(
&self,
_application_identity: &ApplicationIdentity,
_op: Operation
) -> Result<Result> { ... }
fn psa_asymmetric_encrypt(
&self,
_application_identity: &ApplicationIdentity,
_op: Operation
) -> Result<Result> { ... }
fn psa_asymmetric_decrypt(
&self,
_application_identity: &ApplicationIdentity,
_op: Operation
) -> Result<Result> { ... }
fn psa_aead_encrypt(
&self,
_application_identity: &ApplicationIdentity,
_op: Operation
) -> Result<Result> { ... }
fn psa_aead_decrypt(
&self,
_application_identity: &ApplicationIdentity,
_op: Operation
) -> Result<Result> { ... }
fn psa_hash_compute(&self, _op: Operation) -> Result<Result> { ... }
fn psa_hash_compare(&self, _op: Operation) -> Result<Result> { ... }
fn psa_raw_key_agreement(
&self,
_application_identity: &ApplicationIdentity,
_op: Operation
) -> Result<Result> { ... }
fn psa_generate_random(&self, _op: Operation) -> Result<Result> { ... }
fn psa_cipher_encrypt(
&self,
_application_identity: &ApplicationIdentity,
_op: Operation
) -> Result<Result> { ... }
fn psa_cipher_decrypt(
&self,
_application_identity: &ApplicationIdentity,
_op: Operation
) -> Result<Result> { ... }
fn psa_sign_message(
&self,
_application_identity: &ApplicationIdentity,
_op: Operation
) -> Result<Result> { ... }
fn psa_verify_message(
&self,
_application_identity: &ApplicationIdentity,
_op: Operation
) -> Result<Result> { ... }
fn can_do_crypto(
&self,
_application_identity: &ApplicationIdentity,
_op: Operation
) -> Result<Result> { ... }
fn prepare_key_attestation(
&self,
_application_identity: &ApplicationIdentity,
_op: Operation
) -> Result<Result> { ... }
fn attest_key(
&self,
_application_identity: &ApplicationIdentity,
_op: Operation
) -> Result<Result> { ... }
}
Expand description
Provider interface for servicing client operations
Definition of the interface that a provider must implement to be linked into the service through a backend handler.
The methods with no default are used on a service-level by the core provider and so must be supported by all providers.
Required Methods§
sourcefn describe(&self) -> Result<(ProviderInfo, HashSet<Opcode>)>
fn describe(&self) -> Result<(ProviderInfo, HashSet<Opcode>)>
Return a description of the current provider.
The descriptions are gathered in the Core Provider and returned for a ListProviders operation.
sourcefn list_keys(
&self,
_application_identity: &ApplicationIdentity,
_op: Operation
) -> Result<Result>
fn list_keys( &self, _application_identity: &ApplicationIdentity, _op: Operation ) -> Result<Result>
Lists all keys belonging to the application.
sourcefn list_clients(&self, _op: Operation) -> Result<Result>
fn list_clients(&self, _op: Operation) -> Result<Result>
Lists all clients currently having data in the service.
Provided Methods§
sourcefn list_providers(&self, _op: Operation) -> Result<Result>
fn list_providers(&self, _op: Operation) -> Result<Result>
List the providers running in the service.
sourcefn list_opcodes(&self, _op: Operation) -> Result<Result>
fn list_opcodes(&self, _op: Operation) -> Result<Result>
List the opcodes supported by the given provider.
sourcefn list_authenticators(&self, _op: Operation) -> Result<Result>
fn list_authenticators(&self, _op: Operation) -> Result<Result>
List the authenticators supported by the given provider.
sourcefn delete_client(
&self,
_application_identity: &ApplicationIdentity,
_op: Operation
) -> Result<Result>
fn delete_client( &self, _application_identity: &ApplicationIdentity, _op: Operation ) -> Result<Result>
Delete all data a client has in the service..
sourcefn ping(&self, _op: Operation) -> Result<Result>
fn ping(&self, _op: Operation) -> Result<Result>
Execute a Ping operation to get the wire protocol version major and minor information.
§Errors
This operation will only fail if not implemented. It will never fail when being called on
the CoreProvider
.
sourcefn psa_generate_key(
&self,
_application_identity: &ApplicationIdentity,
_op: Operation
) -> Result<Result>
fn psa_generate_key( &self, _application_identity: &ApplicationIdentity, _op: Operation ) -> Result<Result>
Execute a GenerateKey operation.
Providers should try, in a best-effort way, to handle failures in a way that it is possible to create a key with the same name later on.
For providers using a Key Info Manager to map a key name with a provider-specific key identification, the following algorithm can be followed:
- generate unique key ID
- try key creation with it. If successfull go to 3 else return an error.
- store the mappings between key name and key ID. If successfull return success, else go to 4.
- try to delete the key created. If failed, log it and return the error from 3.
sourcefn psa_import_key(
&self,
_application_identity: &ApplicationIdentity,
_op: Operation
) -> Result<Result>
fn psa_import_key( &self, _application_identity: &ApplicationIdentity, _op: Operation ) -> Result<Result>
Execute an ImportKey operation.
Providers should try, in a best-effort way, to handle failures in a way that it is possible to import a key with the same name later on.
For providers using a Key Info Manager to map a key name with a provider-specific key identification, the following algorithm can be followed:
- generate unique key ID
- try key import with it. If successfull go to 3 else return an error.
- store the mappings between key name and key ID. If successfull return success, else go to 4.
- try to delete the key imported. If failed, log it and return the error from 3.
sourcefn psa_export_public_key(
&self,
_application_identity: &ApplicationIdentity,
_op: Operation
) -> Result<Result>
fn psa_export_public_key( &self, _application_identity: &ApplicationIdentity, _op: Operation ) -> Result<Result>
Execute an ExportPublicKey operation.
sourcefn psa_export_key(
&self,
_application_identity: &ApplicationIdentity,
_op: Operation
) -> Result<Result>
fn psa_export_key( &self, _application_identity: &ApplicationIdentity, _op: Operation ) -> Result<Result>
Execute an ExportKey operation.
sourcefn psa_destroy_key(
&self,
_application_identity: &ApplicationIdentity,
_op: Operation
) -> Result<Result>
fn psa_destroy_key( &self, _application_identity: &ApplicationIdentity, _op: Operation ) -> Result<Result>
Execute a DestroyKey operation.
Providers should try, in a best-effort way, to handle failures in a way that it is possible to generate or create a key with the same name than the one destroyed later on.
For providers using a Key Info Manager to map a key name with a provider-specific key identification, the following algorithm can be followed:
- get the key ID from the key name using the KIM
- destroy the key mappings
- try to destroy the key
sourcefn psa_sign_hash(
&self,
_application_identity: &ApplicationIdentity,
_op: Operation
) -> Result<Result>
fn psa_sign_hash( &self, _application_identity: &ApplicationIdentity, _op: Operation ) -> Result<Result>
Execute a SignHash operation. This operation only signs the short digest given but does not hash it.
sourcefn psa_verify_hash(
&self,
_application_identity: &ApplicationIdentity,
_op: Operation
) -> Result<Result>
fn psa_verify_hash( &self, _application_identity: &ApplicationIdentity, _op: Operation ) -> Result<Result>
Execute a VerifyHash operation.
sourcefn psa_asymmetric_encrypt(
&self,
_application_identity: &ApplicationIdentity,
_op: Operation
) -> Result<Result>
fn psa_asymmetric_encrypt( &self, _application_identity: &ApplicationIdentity, _op: Operation ) -> Result<Result>
Execute an AsymmetricEncrypt operation.
sourcefn psa_asymmetric_decrypt(
&self,
_application_identity: &ApplicationIdentity,
_op: Operation
) -> Result<Result>
fn psa_asymmetric_decrypt( &self, _application_identity: &ApplicationIdentity, _op: Operation ) -> Result<Result>
Execute an AsymmetricDecrypt operation.
sourcefn psa_aead_encrypt(
&self,
_application_identity: &ApplicationIdentity,
_op: Operation
) -> Result<Result>
fn psa_aead_encrypt( &self, _application_identity: &ApplicationIdentity, _op: Operation ) -> Result<Result>
Execute an AeadEncrypt operation.
sourcefn psa_aead_decrypt(
&self,
_application_identity: &ApplicationIdentity,
_op: Operation
) -> Result<Result>
fn psa_aead_decrypt( &self, _application_identity: &ApplicationIdentity, _op: Operation ) -> Result<Result>
Execute an AeadDecrypt operation.
sourcefn psa_hash_compute(&self, _op: Operation) -> Result<Result>
fn psa_hash_compute(&self, _op: Operation) -> Result<Result>
Execute a HashCompute operation.
sourcefn psa_hash_compare(&self, _op: Operation) -> Result<Result>
fn psa_hash_compare(&self, _op: Operation) -> Result<Result>
Execute a HashCompare operation.
sourcefn psa_raw_key_agreement(
&self,
_application_identity: &ApplicationIdentity,
_op: Operation
) -> Result<Result>
fn psa_raw_key_agreement( &self, _application_identity: &ApplicationIdentity, _op: Operation ) -> Result<Result>
Execute a RawKeyAgreement operation.
sourcefn psa_generate_random(&self, _op: Operation) -> Result<Result>
fn psa_generate_random(&self, _op: Operation) -> Result<Result>
Execute a GenerateRandom operation.
sourcefn psa_cipher_encrypt(
&self,
_application_identity: &ApplicationIdentity,
_op: Operation
) -> Result<Result>
fn psa_cipher_encrypt( &self, _application_identity: &ApplicationIdentity, _op: Operation ) -> Result<Result>
Encrypt a short message with a symmetric cipher.
sourcefn psa_cipher_decrypt(
&self,
_application_identity: &ApplicationIdentity,
_op: Operation
) -> Result<Result>
fn psa_cipher_decrypt( &self, _application_identity: &ApplicationIdentity, _op: Operation ) -> Result<Result>
Decrypt a short message with a symmetric cipher.
sourcefn psa_sign_message(
&self,
_application_identity: &ApplicationIdentity,
_op: Operation
) -> Result<Result>
fn psa_sign_message( &self, _application_identity: &ApplicationIdentity, _op: Operation ) -> Result<Result>
Sign a message with a private key.
sourcefn psa_verify_message(
&self,
_application_identity: &ApplicationIdentity,
_op: Operation
) -> Result<Result>
fn psa_verify_message( &self, _application_identity: &ApplicationIdentity, _op: Operation ) -> Result<Result>
Verify the signature of a message using a public key.
sourcefn can_do_crypto(
&self,
_application_identity: &ApplicationIdentity,
_op: Operation
) -> Result<Result>
fn can_do_crypto( &self, _application_identity: &ApplicationIdentity, _op: Operation ) -> Result<Result>
Check if the crypto operation is supported by provider.
sourcefn prepare_key_attestation(
&self,
_application_identity: &ApplicationIdentity,
_op: Operation
) -> Result<Result>
fn prepare_key_attestation( &self, _application_identity: &ApplicationIdentity, _op: Operation ) -> Result<Result>
Prepare a key attestation operation.
sourcefn attest_key(
&self,
_application_identity: &ApplicationIdentity,
_op: Operation
) -> Result<Result>
fn attest_key( &self, _application_identity: &ApplicationIdentity, _op: Operation ) -> Result<Result>
Attest a key.