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_GetRandom
function to get an 8-byte random numberRND
from the device, and pads it to the block size of the cryptographic algorithm with0x00
to form the data blockD0
- Encrypts
D0
to get the encrypted resultD1
, and callsSKF_DevAuth
, sendingD1
to the device - Upon receiving
D1
, the device verifies whetherD1
is 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