PreviousNext
decryptBufferRF
Help > OS functions > Encryption > decryptBufferRF

Function

 

Decrypt bufferRF

Purpose

 

The decryption of payload data encrypted by encryptBufferRF

Syntax

 

void decryptBufferRF(uns8 X)

Parameters

 

X.0-5:   Number of 16 B blocks to be decrypted (1 to 4)

X.6:

     0        User key specified by setUserKey is used

     1        User key in bufferINFO[0 to 15] is used

Input values

 

 –

Return value

 

  –

Output values

 

The specified number of blocks in bufferRF is decrypted by the User key.

Preconditions

 

   The same User key must be used as the one used for preceding encryption.

   For networking as well as non-networking communication.

   It is not necessary to decrypt data within IQRF wireless. Decryption can alternatively be done e.g. by a superordinate system.

Remarks

 

     If blocks < 4, the rest of bufferRF remains unchanged.

     Industry standard AES-128 b ECB decryption is used.

Side effects

 

  –

See also

 

setUserKey, encryptBufferRF

Example 1

 

bufferINFO[0 to 15] = ...;

setUserKey();                    // Must be the same key as for encryption

     ...

if (RFRXpacket())

{

  decryptBufferRF(2);            // 32 B decrypted, the rest remains unchanged

     ...                         // User key defined by setUserKey()

}

Example 2

 

bufferINFO[0 to 15] = ...;              // Must be the same key as for encryption

     ...

if (RFRXpacket())

{

  decryptBufferRF(0b01000000 | 2);      // 32 B decrypted, the rest remains unchanged

     ...                                // User key from bufferINFO

}