public class Document extends Object
It can return the document if it is given a ReadInstance and the private key to decrypt the keyMaterial.
| Constructor and Description |
|---|
Document(byte[] data,
byte[] keyMaterial,
byte[] extraData,
DarcId publisherId)
Initialises a document.
|
Document(byte[] data,
byte[] extraData,
DarcId publisherId)
Creates a new document from data, creates a new Darc, a symmetric
symmetricKey and encrypts the data using AES-GCM.
|
| Modifier and Type | Method and Description |
|---|---|
boolean |
equals(Object other)
Compares this document with another document.
|
static Document |
fromCalypso(CalypsoRPC calypso,
InstanceId riId,
Scalar reader)
Fetches a document from calypso, once the read instance has been created.
|
static Document |
fromWriteInstance(WriteInstance wi,
byte[] keyMaterial)
Recreate the document once all the material already is fetched from ByzCoin.
|
byte[] |
getData() |
byte[] |
getExtraData() |
byte[] |
getKeyMaterial() |
DarcId |
getPublisherId() |
WriteData |
getWriteData(CreateLTSReply lts)
Creates a WriteData object with the fields of the document.
|
WriteInstance |
spawnWrite(CalypsoRPC calypso,
DarcId publisherDarcId,
Signer publisherSigner,
Long signerCtr)
Creates a new WriteInstance with the document stored in it.
|
String |
toString() |
public Document(byte[] data,
byte[] keyMaterial,
byte[] extraData,
DarcId publisherId)
data - the data that will be encrypted using the keyMaterialkeyMaterial - key-material necessary for the unencryption of the document.
This will be encrypted before the transmission to the skipchain.extraData - any public data that will be stored unencrypted on the skipchain.publisherId - the publisher darc with the rules to create a WriteInstance and a ReadInstance.public Document(byte[] data,
byte[] extraData,
DarcId publisherId)
data - any data that will be stored encrypted on the skipchain.
There is a limit on how much data can be stored. The limit
depends on the block size configuration in ByzCoin. It is
slightly below the block size because metadata is also stored
in the block. You can find the block size using
ChainConfigInstance. If you need more, this must be a pointer to an
off-chain storage.extraData - any public data that will not be encryptedpublisherId - the publisher darc with the rules to create a WriteInstance and a ReadInstance.public WriteData getWriteData(CreateLTSReply lts) throws CothorityException
lts - the Long Term Secret to use.CothorityException - if something goes wrongpublic WriteInstance spawnWrite(CalypsoRPC calypso, DarcId publisherDarcId, Signer publisherSigner, Long signerCtr) throws CothorityException
calypso - an instance of the calypsoRPCpublisherDarcId - a darc with a 'spawn:calypsoWrite' rulepublisherSigner - a signer having the right to trigger the 'spawn:calypsoWrite' rule.signerCtr - a monotonically increasing counter for publisherSignerCothorityException - if something goes wrongpublic boolean equals(Object other)
public byte[] getKeyMaterial()
public byte[] getExtraData()
public DarcId getPublisherId()
public byte[] getData()
public String toString()
public static Document fromCalypso(CalypsoRPC calypso, InstanceId riId, Scalar reader) throws CothorityException
calypso - an existing calypsoriId - the instance Id of the read instancereader - the private key of the reader (or ephemeral key)CothorityException - if something goes wrongpublic static Document fromWriteInstance(WriteInstance wi, byte[] keyMaterial) throws CothorityNotFoundException, CothorityCryptoException
wi - WriteInstance for this documentkeyMaterial - the decrypted key materialCothorityNotFoundException - if the requested instance cannot be foundCothorityCryptoException - if there's a problem with the cryptographyCopyright © 2019. All rights reserved.