Crypto¶

Hint

The rules for generating queries to the node are given in module How to use REST API.

The description of text data encryption is presented in the subsection Encrypting text data in transactions.

Attention

Nodes of the 1.0 version and below use Base58 encoding to encrypt/decrypt text data. Starting from the 1.0.2 version the Base64 encoding is used. If there are different versions of nodes in the network, use the crypto methods as follows:

• In case of accepting data from newer version nodes by the older version node you need to convert data from the encryptedText string from Base64 to Base58.

• In case of accepting data from older version nodes by the newer version node you need to convert data from the encryptedText string from Base58 to Base64.

POST /crypto/encryptSeparate¶

Encrypts the text separately for the each recipient with the unique key.

Method Query

{
"sender": "3MCUfX4P4U56hoQwSqXnLJenB6cDkxBjisL",
"encryptionText": "some text to encrypt",
"recipientsPublicKeys": [ "5R65oLxp3iwPekwirA4VwwUXaySz6W6YKXBKBRL352pwwcpsFcjRHJ1VVHLp63LkrkxsNod64V1pffeiZz5i2qXc",
}


Method Response

{
"encryptedText": "IZ5Kk5YNspMWl/jmlTizVxD6Nik=",
"publicKey": "5R65oLxp3iwPekwirA4VwwUXaySz6W6YKXBKBRL352pwwcpsFcjRHJ1VVHLp63LkrkxsNod64V1pffeiZz5i2qXc",
"wrappedKey": "uWVoxJAzruwTDDSbphDS31TjSQX6CSWXivp3x34uE3XtnMqqK9swoaZ3LyAgFDR7o6CfkgzFkWmTen4qAZewPfBbwR"
},
{
"encryptedText": "F9uO1ORGvSEDe6dWm1pzJQ+3xqE=",
}


POST /crypto/encryptCommon¶

Encrypts the data with a single CEK key for all recipients and the CEK wraps into a unique KEK for the each recipient.

Method Query

{
"sender": "3MCUfX4P4U56hoQwSqXnLJenB6cDkxBjisL",
"encryptionText": "some text to encrypt",
"recipientsPublicKeys": [ "5R65oLxp3iwPekwirA4VwwUXaySz6W6YKXBKBRL352pwwcpsFcjRHJ1VVHLp63LkrkxsNod64V1pffeiZz5i2qXc",
}


Method Response

{
"encryptedText": "NpCCig2i3jzo0xBnfqjfedbti8Y=",
"recipientToWrappedStructure": {
"5R65oLxp3iwPekwirA4VwwUXaySz6W6YKXBKBRL352pwwcpsFcjRHJ1VVHLp63LkrkxsNod64V1pffeiZz5i2qXc":
"M8pAe8HnKiWLE1HsC1ML5t8b7giWxiHfvagh7Y3F7rZL8q1tqMCJMYJo4qz4b3xjcuuUiV57tY3k7oSig53Aw1Dkkw",
"Doqn6gPvBBeSu2vdwgFYMbDHM4knEGMbqPn8Np76mNRRoZXLDioofyVbSSaTTEr4cvXwzEwVMugiy2wuzFWk3zCiT3"
}
}


POST /crypto/decrypt¶

Decrypts the data. The decryption is available only if the message recipient’s key is in the node’s keystore.

Method Query

{
"recipient": "3M5F8B1qxSY1W6kA2ZnQiDB4JTGz9W1jvQy",

{