Trait rust_cryptoauthlib::AteccDeviceTrait[][src]

pub trait AteccDeviceTrait {
Show methods fn random(&self, rand_out: &mut Vec<u8>) -> AtcaStatus;
fn sha(&self, message: Vec<u8>, digest: &mut Vec<u8>) -> AtcaStatus;
fn nonce(&self, target: NonceTarget, data: &[u8]) -> AtcaStatus;
fn nonce_rand(
        &self,
        host_nonce: &[u8],
        rand_out: &mut Vec<u8>
    ) -> AtcaStatus;
fn gen_key(&self, key_type: KeyType, slot_id: u8) -> AtcaStatus;
fn import_key(
        &self,
        key_type: KeyType,
        key_data: &[u8],
        slot_id: u8
    ) -> AtcaStatus;
fn export_key(
        &self,
        key_type: KeyType,
        key_data: &mut Vec<u8>,
        slot_id: u8
    ) -> AtcaStatus;
fn get_public_key(
        &self,
        slot_id: u8,
        public_key: &mut Vec<u8>
    ) -> AtcaStatus;
fn sign_hash(
        &self,
        mode: SignMode,
        slot_id: u8,
        signature: &mut Vec<u8>
    ) -> AtcaStatus;
fn verify_hash(
        &self,
        mode: VerifyMode,
        hash: &[u8],
        signature: &[u8]
    ) -> Result<bool, AtcaStatus>;
fn get_device_type(&self) -> AtcaDeviceType;
fn is_configuration_locked(&self) -> bool;
fn is_data_zone_locked(&self) -> bool;
fn get_config(&self, atca_slots: &mut Vec<AtcaSlot>) -> AtcaStatus;
fn info_cmd(&self, _command: InfoCmdType) -> Result<Vec<u8>, AtcaStatus>;
fn add_access_key(&self, slot_id: u8, encryption_key: &[u8]) -> AtcaStatus;
fn flush_access_keys(&self) -> AtcaStatus;
fn get_serial_number(&self) -> [u8; 9];
fn is_aes_enabled(&self) -> bool;
fn is_kdf_aes_enabled(&self) -> bool;
fn is_io_protection_key_enabled(&self) -> bool;
fn get_ecdh_output_protection_state(&self) -> OutputProtectionState;
fn get_kdf_output_protection_state(&self) -> OutputProtectionState;
fn release(&self) -> AtcaStatus;
}

Required methods

fn random(&self, rand_out: &mut Vec<u8>) -> AtcaStatus[src]

Request ATECC to generate a vector of random bytes

fn sha(&self, message: Vec<u8>, digest: &mut Vec<u8>) -> AtcaStatus[src]

Request ATECC to compute a message hash (SHA256)

fn nonce(&self, target: NonceTarget, data: &[u8]) -> AtcaStatus[src]

Execute a Nonce command in pass-through mode to load one of the device’s internal buffers with a fixed value. For the ATECC608A, available targets are TempKey (32 or 64 bytes), Message Digest Buffer (32 or 64 bytes), or the Alternate Key Buffer (32 bytes). For all other devices, only TempKey (32 bytes) is available.

fn nonce_rand(&self, host_nonce: &[u8], rand_out: &mut Vec<u8>) -> AtcaStatus[src]

Execute a Nonce command to generate a random nonce combining a host nonce and a device random number.

fn gen_key(&self, key_type: KeyType, slot_id: u8) -> AtcaStatus[src]

Request ATECC to generate a cryptographic key

fn import_key(
    &self,
    key_type: KeyType,
    key_data: &[u8],
    slot_id: u8
) -> AtcaStatus
[src]

Request ATECC to import a cryptographic key

fn export_key(
    &self,
    key_type: KeyType,
    key_data: &mut Vec<u8>,
    slot_id: u8
) -> AtcaStatus
[src]

Request ATECC to export a cryptographic key. For cryptographic security reasons, with KeyType = P256EccKey this function exports only public key

fn get_public_key(&self, slot_id: u8, public_key: &mut Vec<u8>) -> AtcaStatus[src]

Depending on the socket configuration, this function calculates public key based on an existing private key in the socket or exports the public key directly

fn sign_hash(
    &self,
    mode: SignMode,
    slot_id: u8,
    signature: &mut Vec<u8>
) -> AtcaStatus
[src]

Request ATECC to generate an ECDSA signature

fn verify_hash(
    &self,
    mode: VerifyMode,
    hash: &[u8],
    signature: &[u8]
) -> Result<bool, AtcaStatus>
[src]

Request ATECC to verify ECDSA signature

fn get_device_type(&self) -> AtcaDeviceType[src]

Request ATECC to return own device type

fn is_configuration_locked(&self) -> bool[src]

Request ATECC to check if its configuration is locked. If true, a chip can be used for cryptographic operations

fn is_data_zone_locked(&self) -> bool[src]

Request ATECC to check if its Data Zone is locked. If true, a chip can be used for cryptographic operations

fn get_config(&self, atca_slots: &mut Vec<AtcaSlot>) -> AtcaStatus[src]

Returns a structure containing configuration data read from ATECC during initialization of the AteccDevice object.

fn info_cmd(&self, _command: InfoCmdType) -> Result<Vec<u8>, AtcaStatus>[src]

Command accesses some static or dynamic information from the ATECC chip

fn add_access_key(&self, slot_id: u8, encryption_key: &[u8]) -> AtcaStatus[src]

A function that adds an encryption key for securely reading or writing data that is located in a specific slot on the ATECCx08 chip. Data is not written to the ATECCx08 chip, but to the AteccDevice structure

fn flush_access_keys(&self) -> AtcaStatus[src]

A function that deletes all encryption keys for secure read or write operations performed by the ATECCx08 chip

fn get_serial_number(&self) -> [u8; 9][src]

Get serial number of the ATECC device

fn is_aes_enabled(&self) -> bool[src]

Checks if the chip supports AES encryption. (only relevant for the ATECC608x chip)

fn is_kdf_aes_enabled(&self) -> bool[src]

Checks if the chip supports AES for KDF operations (only relevant for the ATECC608x chip)

fn is_io_protection_key_enabled(&self) -> bool[src]

Checks whether transmission between chip and host is to be encrypted (IO encryption is only possible for ATECC608x chip)

fn get_ecdh_output_protection_state(&self) -> OutputProtectionState[src]

Function that reads the read security settings of the ECDH function from chip (only relevant for the ATECC608x chip)

fn get_kdf_output_protection_state(&self) -> OutputProtectionState[src]

Function that reads the read security settings of the KDF function from chip (only relevant for the ATECC608x chip)

fn release(&self) -> AtcaStatus[src]

ATECC device instance destructor

Implementors