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

Decrypting Data with ABE User Keys

Function

Decrypting Data with ABE User Keys

URI

POST /v1/datashare/abe-decrypt

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.

encryptData

Yes

String

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

applyer

Yes

String

Applicant identifier.

provider

Yes

String

Authorizer identifier.

orderSeq

No

String

Order number. This parameter is mandatory when onChainStore is set to true.

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, do not 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

plainData

String

Base64-decoded 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",
  "encryptData" : "string",
  "onChainStore" : "false",
  "applyer" : "did:example:Mb4SshJeN5ukWXkbMJK8xC",
  "provider" : "did:example:Mb4SshJeN5ukWXkbMJK8xC"
}

Example Responses

Status code: 200

Base64-encoded data after ABE decryption.

{
  "plainData" : "aGVsbG8sdGhpcyBpcyBhbiBleGFtcGxlIGZvciBhYmU="
}

Status code: 500

Error response.

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

Status Codes

Status Code

Description

200

Base64-encoded data after ABE decryption.

500

Error response.

Error Codes

See Error Codes.