Updated on 2023-01-18 GMT+08:00

Initializing an ABE Master Key

Function

This API is used to initialize an ABE master key. If the owner has never initialized the ABE master key, the ABE master key is automatically generated and stored on the chain. If the owner already has an ABE master key, it will not be overwritten.

URI

POST /v1/datashare/abe-setup

Request Parameters

Table 1 Request body parameters

Parameter

Mandatory

Type

Description

orgID

Yes

String

Organization ID.

channelID

Yes

String

Channel ID.

cryptoMethod

Yes

String

Encryption method, which is fixed at SW.

cert

Yes

String

Certificate.

sk

Yes

String

Private key.

timestamp

Yes

String

Timestamp.

owner

Yes

String

Key generator identifier.

keyManagerMode

No

String

When using ABE for the first time, select the central or distributed (default) mode. The mode cannot be changed once configured.

Response Parameters

Status code: 200

Table 2 Response body parameters

Parameter

Type

Description

secretJson

String

ABE master private key.

publicKeyJson

String

ABE master public key.

Status code: 500

Table 3 Response body parameters

Parameter

Type

Description

errorCode

String

Error code.

errorMsg

String

Error description.

Example Requests

{
  "orgID" : "ce0ac69b0c8648cd25b44a551780409767c8890b",
  "channelID" : "mychannel",
  "cryptoMethod" : "SW",
  "cert" : "-----BEGIN CERTIFICATE-----\\n...\\n-----END CERTIFICATE-----",
  "sk" : "-----BEGIN PRIVATE KEY-----\\n...\\n-----END PRIVATE KEY-----",
  "timestamp" : "2020-10-27T17:28:16+08:00",
  "owner" : "did:example:8poVETnVCry9ecfHSDeQaR"
}

Example Responses

Status code: 200

ABE master key information.

{
  "secretJson" : "{}",
  "publicKeyJson" : "{}"
}

Status code: 500

Error response.

{
  "errorCode" : "BCS.5002046",
  "errorMsg" : "Incorrect number of arguments"
}

Status Codes

Status Code

Description

200

ABE master key information.

500

Error response.

Error Codes

See Error Codes.