keymaster_device Struct Reference

keymaster_device Struct Reference

#include < keymaster.h >

Data Fields

struct hw_device_t   common
 
uint32_t  client_version
 
uint32_t  flags
 
void *  context
 
int(*  generate_keypair )(const struct keymaster_device *dev, const keymaster_keypair_t key_type, const void *key_params, uint8_t **key_blob, size_t *key_blob_length)
 
int(*  import_keypair )(const struct keymaster_device *dev, const uint8_t *key, const size_t key_length, uint8_t **key_blob, size_t *key_blob_length)
 
int(*  get_keypair_public )(const struct keymaster_device *dev, const uint8_t *key_blob, const size_t key_blob_length, uint8_t **x509_data, size_t *x509_data_length)
 
int(*  delete_keypair )(const struct keymaster_device *dev, const uint8_t *key_blob, const size_t key_blob_length)
 
int(*  delete_all )(const struct keymaster_device *dev)
 
int(*  sign_data )(const struct keymaster_device *dev, const void *signing_params, const uint8_t *key_blob, const size_t key_blob_length, const uint8_t *data, const size_t data_length, uint8_t **signed_data, size_t *signed_data_length)
 
int(*  verify_data )(const struct keymaster_device *dev, const void *signing_params, const uint8_t *key_blob, const size_t key_blob_length, const uint8_t *signed_data, const size_t signed_data_length, const uint8_t *signature, const size_t signature_length)
 

Detailed Description

The parameters that can be set for a given keymaster implementation.

Definition at line 174 of file keymaster.h .

Field Documentation

uint32_t client_version

THIS IS DEPRECATED. Use the new "module_api_version" and "hal_api_version" fields in the keymaster_module initialization instead.

Definition at line 187 of file keymaster.h .

struct hw_device_t common

Common methods of the keymaster device. This must be the first member of keymaster_device as users of this structure will cast a hw_device_t to keymaster_device pointer in contexts where it's known the hw_device_t references a keymaster_device .

Definition at line 181 of file keymaster.h .

void* context

Definition at line 194 of file keymaster.h .

int(* delete_all)(const struct keymaster_device *dev)

Deletes all keys in the hardware keystore. Used when keystore is reset completely.

This function is optional and should be set to NULL if it is not implemented.

Returns 0 on success or an error code less than 0.

Definition at line 249 of file keymaster.h .

int(* delete_keypair)(const struct keymaster_device *dev, const uint8_t *key_blob, const size_t key_blob_length)

Deletes the key pair associated with the key blob.

This function is optional and should be set to NULL if it is not implemented.

Returns 0 on success or an error code less than 0.

Definition at line 237 of file keymaster.h .

uint32_t flags

See flags defined for keymaster_device::flags above.

Definition at line 192 of file keymaster.h .

int(* generate_keypair)(const struct keymaster_device *dev, const keymaster_keypair_t key_type, const void *key_params, uint8_t **key_blob, size_t *key_blob_length)

Generates a public and private key. The key-blob returned is opaque and must subsequently provided for signing and verification.

Returns: 0 on success or an error code less than 0.

Definition at line 202 of file keymaster.h .

int(* get_keypair_public)(const struct keymaster_device *dev, const uint8_t *key_blob, const size_t key_blob_length, uint8_t **x509_data, size_t *x509_data_length)

Gets the public key part of a key pair. The public key must be in X.509 format (Java standard) encoded byte array.

Returns: 0 on success or an error code less than 0. On error, x509_data should not be allocated.

Definition at line 225 of file keymaster.h .

int(* import_keypair)(const struct keymaster_device *dev, const uint8_t *key, const size_t key_length, uint8_t **key_blob, size_t *key_blob_length)

Imports a public and private key pair. The imported keys will be in PKCS#8 format with DER encoding (Java standard). The key-blob returned is opaque and will be subsequently provided for signing and verification.

Returns: 0 on success or an error code less than 0.

Definition at line 214 of file keymaster.h .

int(* sign_data)(const struct keymaster_device *dev, const void *signing_params, const uint8_t *key_blob, const size_t key_blob_length, const uint8_t *data, const size_t data_length, uint8_t **signed_data, size_t *signed_data_length)

Signs data using a key-blob generated before. This can use either an asymmetric key or a secret key.

Returns: 0 on success or an error code less than 0.

Definition at line 257 of file keymaster.h .

int(* verify_data)(const struct keymaster_device *dev, const void *signing_params, const uint8_t *key_blob, const size_t key_blob_length, const uint8_t *signed_data, const size_t signed_data_length, const uint8_t *signature, const size_t signature_length)

Verifies data signed with a key-blob. This can use either an asymmetric key or a secret key.

Returns: 0 on successful verification or an error code less than 0.

Definition at line 269 of file keymaster.h .


The documentation for this struct was generated from the following file: