5.15.1 api mobilekey config

The api/mobilekey/config function is used for reading and writing of location IDs and encryption keys for Bluetooth Authentication.


Service and Privileges Groups

  • Service group is API Access Control.

  • Privileges group is Access Control.


Methods

  • GET – read location IDs and encryption keys

  • PUT – write location IDs or encryption keys


Request

There are no parameters used for GET request.

The PUT request contains parameters in the application/json format.


Table1. PUT Request JSON Keys

Key NameMandatoryExpected ValuesDefault ValueDescription
locationNoString of maximum length of 127 characters

location defines the specific device location for the purpose of Bluetooth authentication. Any string that defines the location uniquely is accepted. The location is broadcasted by the 2N devices and serves for selecting relevant authentication parameters by the Bluetooth authentication device.

keys

NoArray of objects containing encryption keys

keys contains encryption keys that are used for secure communication between a 2N device and a device used for authentication via Bluetooth. The objects in the array have the following keys:

  • type – algorithm type, RSA is currently supported, this key is optional,

  • key – encryption key data (DER format encoded in Base64), use 1024 bit encryption keys, this key is mandatory,

  • ctime – creation time represented as Unix time 32 bit unsigned integer, this key is optional.


Example of PUT Request

URL: https://192.168.1.1/api/mobilekey/config JSON: { "location": "LocationUniqueID", "keys": [ { "type": "rsa", "key": "MIICXAIBAAKBgQCXmIX1U7wGFW3FiDdhq7BIktIc4lg7X2IMxLE83I75S3BRPL/7LCAefnMUJL0uyyFdeMpRoOVhVs/iPfnYPNf4AiQO4lIQh8tSKDeat5IfXSMy9zXMyHeBOBg19R+/uShyJsnLoJoB5MJDowwkOuSMIskK+dA17+3E/Y+ujhhpCQIDAQABAoGAfzHOVAUp4cDhFbgxH5Y6lun5uZqAhXCGiEgQngxBOhJ97uuV+V0QpgVa8S/SPAzbtd2/g7YIQB/i1OVDWJfUbEiuBhr6ZHwk5jfCfF0KkmTQtEBd4bbCz+FWyoy19DUXdsLNMf8GW4eWhooX+NCqc2sfloO4Nz+SpXmqpsMIc/ECQQDk63xVnRqPCgG3fqpLVGWkQl9wmYAIUP8MrdOAfRYfSC/LrjX55lCRj4mAnSzRQfNclSEz2mITkoaCcjn1lTmXAkEAqYdjMEhIrg4LpYzqZDOF6v6w/s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2ECQQDEffSJoyjYwY2rGbPX8N5d9yrp3HLRbH4RjFGR0zCbSaA+PTQwxu2q1Asd8g7LN95UmyvliddJgayDIwnJSGse", "ctime": 1608044538 } ] }

The 2N devices allow up to four encryption keys to be used at one time. The first encryption key in the array is considered to be the primary encryption key and the other encryption keys are secondary. If a Bluetooth device authenticates itself with any secondary encryption key the 2N device will prompt the Bluetooth device to replace its encryption key with the primary encryption key. Because of this the newest encryption key should always be added to the beginning of the array.


If an array of a length shorter than 4 is submitted, the missing encryption keys are deleted (replaced with an empty object).


The key type is not mandatory. If the algorithm type is omitted, the 2N® device will automatically assume RSA (rsa).


The key ctime is not mandatory. If the creation time is omitted or invalid, the 2N device will display Jan 1st 1970 00:00:00 in the configuration web and will not return ctime for this encryption key.


Response

The response to a GET request is in the application/json format. The result object contains keys location and keys.

The response to a PUT request does not contain any details. E.g., if there is an invalid encryption key value, the key will not be written without any notification.

Table 2. Response to GET Request JSON Keys

KeyTypical Returned ValuesDescription
locationString

Location ID of a 2N device. The details are described in the Request section.

keys

Array of objects containing encryption keysThe array length is always 4 (empty objects are returned for the missing keys). The details and structure of objects in the array are described in the Request section.

Example of Response to GET Request

{ "success": true, "result": { "location": "54-1046-0745", "keys": [ { "type": "rsa", "key": "MIICXAIBAAKBgQCXmIX1U7wGFW3FiDdhq7BIktIc4lg7X2IMxLE83I75S3BRPL/7LCAefnMUJL0uyyFdeMpRoOVhVs/iPfnYPNf4AiQO4lIQh8tSKDeat5IfXSMy9zXMyHeBOBg19R+/uShyJsnLoJoB5MJDowwkOuSMIskK+dA17+3E/Y+ujhhpCQIDAQABAoGAfzHOVAUp4cDhFbgxH5Y6lun5uZqAhXCGiEgQngxBOhJ97uuV+V0QpgVa8S/SPAzbtd2/g7YIQB/i1OVDWJfUbEiuBhr6ZHwk5jfCfF0KkmTQtEBd4bbCz+FWyoy19DUXdsLNMf8GW4eWhooX+NCqc2sfloO4Nz+SpXmqpsMIc/ECQQDk63xVnRqPCgG3fqpLVGWkQ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5rmkCQBZXhnxnF9+Iei5y/dKxpKYFFVVdCYOMFgtHMR42SHyD2Q8R6Dvpex2Ml4EYJULxr0TEqz6Z75M/cMGSF9d9K2ECQQDEffSJoyjYwY2rGbPX8N5d9yrp3HLRbH4RjFGR0zCbSaA+PTQwxu2q1Asd8g7LN95UmyvliddJgayDIwnJSGse", "ctime": 1608046389 }, { "type": "rsa", "key": "MIICXQIBAAKBgQCwWXVu2CNcUFgoqQBQ5NjaLJVEWuAFryK/h9jfNe+qDufFS+itWsWfvyvMkUhhiidPCpgoOgqEipkYa0q3maPKPS4CJXZBFo++JSzsgw6a/VxH0n8joHfJf6nIEcCGcuMAa/HOEoOZq7uL7n2jTsyVnnDbYClXENh4Np9izSX23QIDAQABAoGBAI5iDFDMrfAw5p0dpqWpv/SXnoUsIkg0mYeu9UlzUOgrVLKVkW22Jm3OelyWyKwIUaid0zBXfHp7NRTkO9V1dSnS5CnuO73tye9MV5TeLqjMSBVCSPZWJK//hu1VaRAL9UTZc+1e277lOB8c1Fup4uxR4b757brrclNKjT1U4Hh5AkEA4mFz+IrgTtdiLNLQdww5B3ZELmaOl+lkYgC50hvqy2TDNGGiKGPqYmEd/4ySHBmaGnoh9ZFxnC/ItrNEXBGdawJBAMdsOd2qDdbOSie2TpsGJs5eEUrLX6yW/w+siO4SXczCTnJXckZyj79eEOcnrTRK+SuDsN+8+wmO3b9CZqxOxtcCQQCUkukOAfddRzaDvIhc2YTERPZSjbSgNulO+LL8Fp5uht8mjb1jTNATaTHK+nMaRiNBpU6MYLxziVjtr5H56wWpAkA0fXYVtEcEPTQjk8bI4yufsf7XMwSxxuTH2WAJWeg6lwJS8lVv2YOgmT/VuAnM89b17ynFGlbxQxt21iF0RR/tAkA0nJMkbD3daWYAutdOQjzemae3O0O9r90NZ/Khj5tQpv8gLe6EEpyFUNQNqodNoTmkIJJmPLlBjyx+zTspdE+C" }, { } ] } }

location is by default the serial number of a 2N device. Change it accordingly to add several devices to one location.