BALTECH Docs |
C API for BALTECH SDK
|
brp_errcode brp_Sec_SetKey | ( | brp_protocol | protocol, |
unsigned | ContinuousIV, | ||
unsigned | Encrypted, | ||
unsigned | MACed, | ||
unsigned | SessionKey, | ||
unsigned | DeriveKey, | ||
unsigned | SecLevel, | ||
brp_buf | Key | ||
) |
Sets a key and the appropriate Authorization Mode bits for a specified Security Level.
Please note that if DeriveKey is not 0, Sec.SetKey will not use the Key parameter as a new key value for the authentication of security level SecLevel directly. Instead, it encrypts the key specified in DeriveKey with the key specified in Key (via AES), and uses this encrypted key as a new key value for the authentication of security level SecLevel.
If one or more of the SessionKey , MACed , Encrypted or ContinuousIV bits are set, it is not possible to authenticate without the corresponding authentication mode setting.
[in] | protocol | used to execute the command |
[in] | ContinuousIV | If true , encryption/MACing will use Cipher Block Chaining (CBC). In this case, a continuous initial vector (IV) will be used. If this bit is not set, CBC is not used, i.e. the IV will be reset to all zeros (00 00 ... 00) before every command or response is encrypted/MACed. |
[in] | Encrypted | Requires that commands running in this security level always have to be encrypted. This flag cannot be set at the same time as the MACed flag. |
[in] | MACed | Requires that commands running in this security level always have to be MACed. This flag cannot be set at the same time as the Encrypted flag. |
[in] | SessionKey | Requires a two-phase authentication to be able to enter a security level. This two-phase authentication process needs to be performed using the brp_Sec_AuthPhase1() and brp_Sec_AuthPhase2() commands. |
[in] | DeriveKey | This value specifies a key which will be encrypted by the Key value and used as authentication key for security level SecLevel. If this parameter is 0, the authentication key is directly set by the Key parameter. |
[in] | SecLevel | The security level for which the key has to be set. |
[in] | Key | Key/Password for authentication of security level SecLevel. |