Skip to content

Device Security Manufacturer Interface

bradreevmx edited this page Jul 20, 2018 · 9 revisions

API List

Model Security Information

WriteAdmin
Delete
WriteAdmin
ReadAdminList

Mediation

WriteMediator
ReadMediatorList
ReadMediatorAdminList
ReadMediationState
WriteMediatorAdmin
ExitMediationState


Model Management

Write

This function write a new set of security, MUD, and firmware version information to a given ModelId. The ModelId is created through the WriteAdmin function. A ModelId must first be assigned an Admin prior to writing version information.

Often portions of the security record may not change between versions. However, all portions of the record must be written for each version to allow for easier reading of the record by the user.

Each write will append the new input to the end of the ModelID Security record.

Input Parameters

Type Name Description
address ModelId ModelId for the model.
string MUD JSON manufacture usage data per IETF MUD.
string Security JSON security assertion
string VersionName Version name, which shall match the version reported by the device
string URI Firmware update URI

Return Values

Type Name Description
bool Status True if the operation was successful

Example

var JsonData = '{"Mfg":"MfgA","Model":"ModelB","HwVer":"Hw1","FwVer":"Fw2"}'
var ModelId = "0xbd4d579e0819c4ab3d1b6d59b8429218fc923507";
DeviceSecurity.Write(ModelId, JsonData, {from:ContractOwner,gas:470000});

Delete

This function deletes the last security entry for the modelID. If an intermediate version needs to be modified, the manufacturer must delete all entries including the version which needs to be modified. The manufacturer would then write the update, and all newer versions which followed from the updated record.

Input Parameters

Type Name Description
address ModelId ModelId for the model.

Return Values

Type Name Description
bool Status True if the operation was successful

Example

var ModelId = "0xbd4d579e0819c4ab3d1b6d59b8429218fc923507"
DeviceSecurity.Delete(ModelId, {from:AdminA,gas:470000});

WriteAdmin

This function assigns an Admin to the device security record for the ModelID. There may be up to five administrators per ModelID record.

Input Parameters

Type Name Description
address ModelId ModelId for the model.
uint Index Admin Index
address NewAdmin Administrator's ID to be written into the index

Return Values

Type Name Description
bool Status True if the operation was successful

Example

var ModelId = "0xbd4d579e0819c4ab3d1b6d59b8429218fc923507";
DeviceSecurity.WriteAdmin(ModelId, 1, AdminB, {from:AdminA,gas:470000});

ReadAdminList

This function returns the current list of Administrators.

Input Parameters

Type Name Description
address ModelId ModelId for the model.

Return Values

Type Name Description
address AdminList List of administrators

Example

var ModelId = "0xbd4d579e0819c4ab3d1b6d59b8429218fc923507";
DeviceSecurity.ReadAdminList(ModelId, {from:AdminA,gas:470000});

Mediation Management

WriteMediator

This function writes a mediator to the ModelID record. There may be up to 5 mediators per ModelID.

Input Parameters

Type Name Description
address ModelId ModelId for the model.
uint Index Mediator Index
address MediatorID MediatorID to be written to the MediatorList

Return Values

Type Name Description
bool Status True if the operation was successful

Example

var ModelId = "0xbd4d579e0819c4ab3d1b6d59b8429218fc923507"
var Index = 0;
var MediatorId = "0x1bbe4a661fdcb10ccc698ff484549555513684dc"
DeviceSecurty.WriteMediator(ModelId, Index, MediatorId, {AdminId,gas:470000});

ReadMediatorList

This function returns the entire Mediator List.

Input Parameters

Type Name Description
address ModelId ModelId for the model.

Return Values

Type Name Description
address[] MedaitorID Mediator List

Example

var ModelId = "0xbd4d579e0819c4ab3d1b6d59b8429218fc923507"
DeviceSecurity.ReadMediatorList(ModelId, {AdminId,gas:470000})

ReadMediatorAdminList

This function returns the entire list of Administrators which each Mediator has voted for.

Input Parameters

Type Name Description
address ModelId ModelId for the model.

Return Values

Type Name Description
address[] MedaitorID Mediator List

Example

var ModelId = "0xbd4d579e0819c4ab3d1b6d59b8429218fc923507"
DeviceSecurity.ReadMediatorAdminList(ModelId, {AdminId,gas:470000})

ReadMediationState

This function returns the current mediation state for the ModelID.

The mediation states are as follows:

State Value
MediationStateNormal 0
MediationStateInMediation 1
MediationStateReadyForNewAdmin 2

Input Parameters

Type Name Description
address ModelId ModelId for the model.

Return Values

Type Name Description
utin MediationState Mediation State

Example

var ModelId = "0xbd4d579e0819c4ab3d1b6d59b8429218fc923507"
DeviceSecurity.ReadMediationState(ModelId, {AdminId,gas:470000})

WriteMediatorAdmin

A mediator shall use this function to write a new administrator.

Input Parameters

Type Name Description
address ModelId ModelId for the model.
uint Index Mediator's index
address AdminID New administrator's ID

Return Values

Type Name Description
bool Status True when successful

Example

var ModelId = "0xbd4d579e0819c4ab3d1b6d59b8429218fc923507"
var Index = 1
var NewAdmin = "0xbd4d579e0819c4ab3d1b6d59b8429218fc92111"
DeviceSecurity.WriteMediatorAdmin(ModelId, Index, NewAdmin, {AdminId,gas:470000})

ExitMediationState

Once a new admin has been added, based on the agreement of the mediators, the new admin will take ownership of the record and exit mediation.

Input Parameters

Type Name Description
address ModelId ModelId for the model.

Return Values

Type Name Description
bool Status True when successful

Example

var ModelId = "0xbd4d579e0819c4ab3d1b6d59b8429218fc923507"
DeviceSecurity.ExitMediationState(ModelId, {AdminId,gas:470000})

Clone this wiki locally