Blockchain with iText Core
Blockchain has become well-known because of its use with Bitcoin, but there are several lesser known applications of Blockchain and Distributed Ledger Technology (DLT). By integrating the Blockchain technology into iText Core, you increase the security of your invoices, documents or tenders by storing the digital signatures in a Blockchain and not in the PDF documents themselves.
Why use iText & Blockchain Technology?
-
Track in real time who has already signed a contract, and with whom it is now
-
Before paying a digital invoice you can check its authenticity and who signed it
-
Secure your digital tender documents and follow their path
-
Send binding offers to customers and rest assured they cannot be tempered with
-
Send internal memos to employees and be able to see who has read them and when
-
Elevate the legal status of any document
These solutions and many more can now be implemented with iText & Blockchain Technology to secure your documents and for a highly effective document workflow.
Continue reading to discover more.
Cost reduction
-
Speed up interactions between clients and stakeholders.
-
Reduce your paper trail.
-
Automate your processes.
Better and secured communication
-
Secure and authenticate digital invoices
-
Secure sensitive information
-
Avoid unauthorized document manipulation
-
Be able to prove that documents have been received and by whom
-
Check if information has been received
-
Speed up and secure company internal communication
And there is much more iText & Blockchain Technology can do for your business.
Track real time
-
Be able to check who already signed a contract, agreement, bill of lading etc...
-
Check who is in possession of a document now.
-
For logistics (shipping bill) track a packages current location.
-
For events you can check the current number of arrivals
-
Real time information (boarding pass) who has already boarded an airplane
and much more
Core Capabilities of Blockchain with iText Core
A blockchain holds data. It collects this data in units called 'blocks'. There is a mechanism to prove a block has not been tampered with. And over time, blocks get chained together. This chaining organically enables a kind of 'history'.
A blockchain supersedes older technology that deals with authentication and nonrepudiation. First, there are many ways you can digitally sign a document. Typically by "signing" we mean creating a hash of a document, creating a signature from that hash with a private key, and storing the signature. This has two effects:
- the signature identifies the person who signed the document.
- the signature, when decrypted, identifies the file from which it was computed.
Once such a signature is stored in a blockchain, it can not be changed or deleted. This gives you an extra advantage: the fact that your signature is in the blockchain gives you a point in time when the operation was done.
Data in a blockchain
- Can be signed using known PKI-infrastructure
- Is automatically validated and timestamped
- Can be viewed by everyone
- Exists separately from the actual data (document) it references..
Relation to PDF
- PDF documents can be digitally signed.
- Web of trust
- Integrity: “The document content has not been altered.”
- Authentication: “I created this document. And I can prove it.”
- Non-repudiation: “He created this document. And I can prove it.”
- Timestamp
Secure digital signatures
- Requires Certificate Authority (centralized).
- Requires timeserver (centralized).
- Cannot be signed in parallel.
- Signatures live in the document.
Theoretical usecase - high level
On a high level, the idea is to separate the functionality of signing and the integrity away from the pdf, transferring them into the Blockchain. Following you'll find a real life example case.
- A document is created, and the document ID (along with its hash, and the name of the hashing algorithm) is placed on a public Blockchain. This does not cause any problems, since the hash typically does not allow you to rebuild the document. The hashing algorithm is placed on the chain as well to ensure long term validation.
- As it happens, this document is an invoice. Bob has had some work done on his house, and the renovation company sends him a digital PDF invoice.
- Bob wants to sign the invoice to indicate he agrees with the price and will pay. He uses his private key to encrypt the hash-value of the document. This signature (comprising of the ID of the document, the original hash-value, the signed hash-value, as well as the names of the hashing algorithm and signing algorithm) are stored on the Blockchain.
- Alice, who works for the renovation company wants to check whether Bob has already signed and thereby accepted the invoice . She can easily look up all records on the Blockchain for a given ID (the document ID). In this case, one of these records is be the record Bob created earlier. Since the record contains the original hash, and the names of all the algorithms involved, Alice can verify 2 things
- It was Bob that signed, using the hash, the signed hash, and his public key.
- Bob signed the exact document she sent him, using the document ID and the hash.
In short, Bob accepted the invoice as correct and will pay.
Theoretical usecase - low level
Implementation
The interfaces we impose on blockchain implementations are minimal, yet they provide us with the needed abstraction to enable us to build complex applications and workflows on top of them. We abstract a blockchain as a multimap, allowing end-users to store an object (represented by Record, which is HashMap) and tying it to a key (String).
public interface IBlockChain {
/**
* Put data on the blockchain
*
* @param key the key being used to put the data on the blockchain
* @param data the data being put on the blockchain
*/
public boolean put(String key, Record data);
/**
* Get data from the blockchain
*
* @param key the key being queried
* @return
*/
public List<Record> get(String key);
/**
* Get all data from the blockchain
* @return
*/
public List<Record> all();
}
Concrete implementation using JSON-RPC and MultiChain
As a proof of concept we have provided an implementation of the interface IBlockchain using JSON-RPC (remote procedure call) and MultiChain.
If you want to learn more about setting up a blockchain instance with MultiChain, check out their website for more resources, in particular the getting started guide here.
An example of iText & Blockchain
In this example, we will show you how to put a document on the blockchain, with signature:
IBlockChain mc = new MultiChain(
"http://127.0.0.1",
4352,
"chain1",
"stream1",
"multichainrpc",
"BHcXLKwR218R883P6pjiWdBffdMx398im4R8BEwfAxMm");
InputStream keystoreInputStream = BasicFunctionalityTest.class.getClassLoader().getResourceAsStream("ks");
InputStream inputFileStream = BasicFunctionalityTest.class.getClassLoader().getResourceAsStream("input.pdf");
AbstractExternalSignature sgn = new DefaultExternalSignature(keystoreInputStream, "demo", "password");
PdfChain chain = new PdfChain(mc, sgn);
// put a document on the chain
boolean wasAdded = chain.put(inputFileStream);
Assert.assertTrue(wasAdded);
// check whether the chain now contains this value
boolean isEmpty = chain.get("z�L{�Wd=��\u007F\u0010��G�").isEmpty();
You can retrieve information about a document from the blockchain like this:
IBlockChain mc = new MultiChain(
"http://127.0.0.1",
4352,
"chain1",
"stream1",
"multichainrpc",
"BHcXLKwR218R883P6pjiWdBffdMx398im4R8BEwfAxMm");
PdfChain chain = new PdfChain(mc);
for(Record record : chain.get(new File("example_file.pdf")))
{
for(Map.Entry<String,Object> en : record.entrySet())
{
System.out.println(en.getKey() + "\t" + en.getValue().toString());
}
System.out.println("");
}
Still have questions about PDF solutions with blockchain?
We're happy to help! Send your questions to us, and we'll get back to you a.s.a.p.