Updated on 2023-03-07 GMT+08:00

Obtaining Plaintext Data

Function

This API is used to obtain the decrypted plaintext. Watermarking is not supported.

URI

POST /v1/datashare/dataset/query-plaintext

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.

consumer

Yes

String

Order applicant identifier.

orderSeq

Yes

String

Order number.

encryptData

No

String

Ciphertext data. This parameter is optional when onChainStore is set to true.

watermarkType

No

String

Watermark type, which can be visible or blind. Specify this parameter if you want to embed a watermark. If a blind watermark has already been embedded into the data set to be published or shared, no more blind watermarks can be embedded into the data set. The embedded watermark is in the format of User DID_Order ID.

onChainStore

No

String

Whether to store ciphertext data on the chain. The value can be true or false (default). If you set this parameter to true, you do not need to specify encryptData. The ciphertext data can be automatically obtained from the chain.

Response Parameters

Status code: 200

Table 2 Response body parameters

Parameter

Type

Description

provider

String

Order provider identifier.

productID

String

Data set product ID.

plaintext

String

Plaintext of the Base64-encoded data.

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",
  "consumer" : "did:example:3TMWx8owKHARgNwbj4ywmG",
  "orderSeq" : "1",
  "encryptData" : "base64 encoding string",
  "watermarkType" : "string",
  "onChainStore" : "string"
}

Example Responses

Status code: 200

Order information.

{
  "provider" : "did:example:DHkJjyD5wZwya6sd6BNBnG",
  "productID" : "product1",
  "plaintext" : "base64 encoding string"
}

Status code: 500

Error response.

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

Status Codes

Status Code

Description

200

Order information.

500

Error response.

Error Codes

See Error Codes.