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,
int keylen,
byte[] extraData,
DarcId publisherId)
Creates a new document from data, creates a new Darc, a symmetric
symmetricKey and encrypts the data using CBC-RSA.
|
| 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(LTS lts)
Creates a WriteData object with the fields of the document.
|
WriteInstance |
spawnWrite(CalypsoRPC calypso,
DarcId publisherDarcId,
Signer publisherSigner)
Creates a new WriteInstance with the document stored in it.
|
String |
toString() |
public Document(byte[] data,
byte[] keyMaterial,
byte[] extraData,
DarcId publisherId)
throws CothorityCryptoException
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.CothorityCryptoException - in the case the encryption doesn't workpublic Document(byte[] data,
int keylen,
byte[] extraData,
DarcId publisherId)
throws CothorityCryptoException
data - any data that will be stored encrypted on the skipchain.
There is a 10MB-limit on how much data can be stored. If you
need more, this must be a pointer to an off-chain storage.keylen - how long the symmetric symmetricKey should be, in bytes. 16 bytes
should be a safe guess for the moment.extraData - any public data that will not be encryptedpublisherId - the publisher darc with the rules to create a WriteInstance and a ReadInstance.CothorityCryptoException - in the case the encryption doesn't workpublic WriteData getWriteData(LTS lts) throws CothorityException
lts - the Long Term Secret to use.CothorityExceptionpublic WriteInstance spawnWrite(CalypsoRPC calypso, DarcId publisherDarcId, Signer publisherSigner) 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.CothorityExceptionpublic boolean equals(Object other)
public byte[] getKeyMaterial()
public byte[] getExtraData()
public DarcId getPublisherId()
public byte[] getData()
throws CothorityCryptoException
CothorityCryptoExceptionpublic 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)CothorityExceptioncom.google.protobuf.InvalidProtocolBufferExceptionpublic static Document fromWriteInstance(WriteInstance wi, byte[] keyMaterial) throws CothorityNotFoundException, CothorityCryptoException
wi - WriteInstance for this documentkeyMaterial - the decrypted key materialCothorityNotFoundExceptionCothorityCryptoExceptionCopyright © 2018. All rights reserved.