A protected item is defined by the structure in the dongle memory called descriptor. The descriptor contains fields describing the type of data stored in the protected item, its properties, status, activation/deactivation passwords and passwords for executing operations with data.

A protected item/hardware algorithm is addressed by its numerical name. Number name is a 2-byte identifier kept in a special table of item number names and algorithms (Algorithm Root Table, ART). A number name allows identifying the item regardless what memory area is occupies, since the items can be placed randomly in the memory.

Field offset from the beginning of descriptorField length (bytes)Field nameField description
00h1rs_LoFlagsLower byte of flags, see nsafl_xxx
01h1rs_algoAlgorithm type, see rs_algo_XXXX
02h2ReservedForEvenReserved
04h4rs_HiFlagsMore flags, see nsafh_xxx
08h4rs_klenData size of protected item or dongle (determinant) algorithm in bytes (rs_K[])
0C4rs_blenSize of data block for hardware algorithm
108rs_hashThis field is reserved and must be filled with 0
184rs_ActivatePwdActivation password (if flag nsafl_ActivationSrv exists)
1C4rs_DeactivatePwdDeactivation password (if flag nsafl_DeactivationSrv exists)
204rs_ReadPwdPassword for reading fields rs_GP, rs_ErrorCounter, rs_K[] using GrdPI_Read function (if flag nsafh_ReadPwd exists)
244rs_UpdatePwdPassword for updating field rs_GP, rs_ErrorCounter, rs_K[] using GrdPI_Update function(if flag nsafh_UpdateSrv exists)
286rs_BirthTime 
2E6rs_DeadTime 
348rs_Lifetime 
3C8rs_FlipTime 
444rs_GPReverse counter
484rs_ErrorCounterPermissible number of password entry attempts (if one of the following flags exists: nsafl_ ActivationSrv, nsafl_DeactivationSrv or nsafl_UpdateSrv)
4Crs_klenrs_K[]Protected item data or algorithm determinant sized rs_klen

 

Field rs_LoFlags contains lower byte of flags defining the properties of protected items. The following flags can be set (flag names listed below are used in Guardant API):

Flag nameValueComment
nsafl_ID1 
nsafl_GP_dec2Decrements GP counter on each algorithm call. Once GP counter reaches 0, algorithm is automatically deactivated and returns error code GrdE_InactiveItem in response to further calls
nsafl_GP4Not used for modern dongles
nsafl_ST_III8Flag should be set for modern dongles
nsafl_ActivationSrv16Activation service available
nsafl_DeactivationSrv32Deactivation service available
nsafl_UpdateSrv64Password-protected service for changing data in items rs_K[] available (GrdPI_Update function supported)
nsafl_InactiveFlag128Algorithm/cell is inactive at the moment. Operations GrdTransform, GrdPI_Read, GrdPI_Update not available
Flag name / Algorythm typeAES128,GSII64ECC160SHA256Loadable CodeProtected Item
nsafl_ID+----
nsafl_GP_dec++++-
nsafl_GP-----
nsafl_ST_III++++-
nsafl_ActivationSrv+++++
nsafl_DeactivationSrv+  ++++
nsafl_UpdateSrv+++++
nsafl_InactiveFlag+++++
nsafh_ReadSrv+++++
nsafh_ReadPwd+++++   
nsafh_BirthTime++++-
nsafh_DeadTime++++-
nsafh_LifeTime++++-
nsafh_FlipTime+----

 

Field rs_algo contains protected item type code.

    1. The following protected item type codes available for Guardant Sign/Time/Net dongles:

      Flag nameValueComment
       0-4Reserved
      rs_algo_GSII645Symmetrical data encryption algorithm. 128 or 256-bit secret key
      rs_algo_HASH646Calculation of 64-bit hash. 128 or 256-bit secret key
      rs_algo_RND647Generation of 64-bit random number
      rs_algo_PI8Protected item
      rs_algo_GSII64_ENCRYPT10 
      rs_algo_GSII64_DECRYPT11 
      rs_algo_ECC16012 
      rs_algo_AES12813 
      rs_algo_SHA25615 
    2. The following protected item type codes available for Guardant Code/Code Time:

      Flag nameValueComment
      rs_algo_PI8Protected item
      rs_algo_ECC16012 
      rs_algo_AES12813 
      rs_algo_LoadableCode14 
      rs_algo_SHA25615 
      rs_algo_AES128Encode16 
      rs_algo_AES128Decode17 

Field rs_HiFlags contains 4 bytes of flags defining the properties of protected items. The following flags can be set (flag names listed below are used in Guardant API):

Flag nameValueComment
nsafh_ReadSrv1Service of reading data in items rs_K[] available (GrdPI_Read function supported)
nsafh_ReadPwd2Reading is password-protected (rs_ReadPwd)
nsafh_BirthTime4 
nsafh_DeadTime8 
nsafh_LifeTime16 
nsafh_FlipTime32 

 

Field rs_klen contains the size of data rs_K[] stored in the protected item (dongle secret key) in bytes.

Field rs_blen contains data block size for hardware algorithm. Possible values :

Algorythm TypePrivate key length (rs_klen), BMinimum data block size (rs_blen), B
GSII64GrdADS_GSII64=16/32GrdARS_GSII64=8
HASH64GrdADS_HASH64=16/32GrdARS_HASH64=8
RND64GrdADS_RAND64=16/32GrdARS_RAND64=8
AES128GrdADS_AES128=16GrdARS_AES128=16
ECC160GrdADS_ECC160=20GrdARS_ECC160=20
SHA256-GrdARS_HASH_SHA256=0
Loadable Codesizeof(TGrdLoadableCodeData)N/A

 

If a wrong value is entered for GSII64, HASH64 and RND64 hardware algorithms, the private key size is set to 16 bytes by default.

Field rs_hash is reserved for future use.

Field rs_ActivatePwd contains 4-byte protected item activation password if activation service is enabled by setting flag nsafl_ActivationSrv.

Field rs_DeactivatePwd contains 4-byte protected item deactivation password if deactivation service is enabled by setting flag nsafl_DeactivationSrv.

Field rs_ReadPwd contains 4-byte protected item reading password if data reading service is enabled by setting flag nsafh_ReadPwd.

Field rs_UpdatePwd contains 4-byte protected item update password if data update service is enabled by setting flag nsafh_UpdateSrv.

OffsetSizeNameValue
0BYTEBSeconds0 <= Seconds <= 59
1BYTEBMinute0 <= Minutes <= 59
2BYTEBHour0 <= Hours <= 23
3BYTEBDay1 <= Days <= 31
4BYTEBMonth1 <= Months <= 12
5BYTEBYear0 <= Years <= 99, since 2000

 

Field rs_GP contains an algorithm counter. If flag nsaf_GP_dec is set, this field defines the number of times the algorithm will be executed. Upon reaching zero the algorithm will be deactivated & will stop converting the data. GrdE_InactiveItem error code will return upon further calls. This field can be increased only by completely rewriting the descriptor.

Field rs_GP contains an algorithm counter. If flag nsaf_GP_dec is set, this field defines the number of times the algorithm will be executed. Upon reaching zero the algorithm will be deactivated & will stop converting the data. GrdE_InactiveItem error code will return upon further calls. This field can be increased only by completely rewriting the descriptor.

Field rs_K[] contains protected item data. Depending on the item type it may be used for storing the secret algorithm key, LMS license table or any other data. The size of data should match the value of km_ad_klen field. The data in the protected items can be accessed or edited only using special functions. The main difference of a protected item from simple data is that the data stored in the protected item can be changed only using a special password. Such mechanism provides for safer alteration of a part of dongle memory without affecting the rest of the memory.

  • No labels