With the traditional RSA cryptography it is easy to share encrypted data between multiple parties. Mechanism known from RSA do not work like that if you have to work with elliptic curves in blockchain environments.
For example in blockchain environments not the public key is known by the public public but the hash of the public key. This hash is usually also used as address.
In our system it is possible to publish the public key to other as it is common in RSA environments. To do so you just have to use the function PublishMyPublicKey from the Identity Namespace.
Once a public key is known a common secret can be calculated by both parties. This can be used to encrypt data in a way that it is decryptable by both parties.
With our system it is possible to encrypt data in a way that it is decryptable by many parties.
SaveShareableData
To save such data you need to use the function: SaveShareableData from the Identity Namespace. It requires 4 parameters of which the last parameter is optional:
DataSTR: The data to encrypt and share encrypted with other parties. Be it health data, KYC files, Call detail records (CDR’s), etc.
ChainAddress: Is the encryptors chain address (hash of its public key)
MyChainPassword: Password to unlock the private key of the ChainAddress.
OtherChainAddress: Chain address of other party allowed to decrypt and view the data. If left empty ChainAddress will be used instead and only the owner of ChainAddress can view or share the data.
The return value are three comma separated values. The first one is the FileID given to the encrypted data saved. The second value is the StorageName (random address of the encrypted secret) and the last parameter is the owners address.
GetShareableData
To decrypt and view that data the other party has to call: GetShareableData with 3 parameters of which the last one is optional:
IndexSTR: The comma separated values returned by SaveShareableData.
ChainAddress: Is the decryptors chain address (hash of its public key)
MyChainPassword: Password to unlock the private key of the ChainAddress.
If you want to share the encrypted data with another party you need to call SharedSecrect.
If you have an account on https://ssi.codeb.io you can have a look at our file uploader as that uses the above functions:
https://ssi.codeb.io/storage.aspx
If you do not have an account you can use our public test account:
To make testing easier we created a test account for you:
Address/Login: 0x8274d660759f3baba9c9f1aa748c1dae956966f1
Password: test