pub trait DeviceAuth {
// Required methods
fn device_auth(&self, data: &[u8]) -> Result<()>;
fn change_device_auth_key(&self, key: &[u8]) -> Result<()>;
}Expand description
Device authentication
Required Methods§
Sourcefn device_auth(&self, data: &[u8]) -> Result<()>
fn device_auth(&self, data: &[u8]) -> Result<()>
Device authentication
[data] - The authentication data
§authentication process
- Call the
SKF_GetRandomfunction to get an 8-byte random numberRNDfrom the device, and pads it to the block size of the cryptographic algorithm with0x00to form the data blockD0 - Encrypts
D0to get the encrypted resultD1, and callsSKF_DevAuth, sendingD1to the device - Upon receiving
D1, the device verifies whetherD1is correct. If correct, the device authentication passes, otherwise the device authentication fails.
Sourcefn change_device_auth_key(&self, key: &[u8]) -> Result<()>
fn change_device_auth_key(&self, key: &[u8]) -> Result<()>
Change device authentication key
[key] - The new authentication key