mercoledì 7 marzo 2018

Science and fiction fans

Interested in Science-Fiction novels ? Here is my first foray on the topic!
The title is: "Chronicles from a Simulated World".
It's a book about stories, or simple facts of life of people, in their quest to answer a simple yet tricky question:"Is our world real?"
Through the voice of these people I will try to convince you that this world has been carefully programmed (be it for fun or as an experiment) by somebody living in an High Castle.
Available in English and Italian.


Are we living in a simulation ?
10 reasons why we might be living in a simulation

venerdì 24 febbraio 2012

PDF digital signature example


This tutorial shows how to digitally sign a PDF document using JSignPDF. JSignPDF is a free software which lets you digitally sign PDF documents for free. A digital signature is necessary these days. To have a digital signature over a PDF might be a bit complicated but JSignPDF is a one stop solution for this question.

At first download JSignPDF from sourceforge. Follow the simple installation instructions.
In order to get started we need a pair of private/public keys which are necessary to generate certificates. We will use the Java utility keytool.

D:\keys>keytool -genkey -dname "cn=Tom Jones, ou=JavaSoft, o=Sun, c=US" -alias business -keypass mypass -keystore mykeystore -storepass mypass -validity 180

D:\keys>keytool -export -alias business -keystore mykeystore -keypass mypass -storepass mypass -file MJ.cer

This first command creates the keystore named "mykeystore" in the "working" directory, and assigns it the password "mykeystore". It generates a public/private key pair for the entity whose "distinguished name" has a common name of "Tom Jones", organizational unit of "JavaSoft", organization of "Sun" and two-letter country code of "US".
With the second command, you export the certificate and supply it to your clients. As a result you will obtain a certificate named MJ.cer

Now launch JSign and enter the properties of your keystore into the form fields. The keys generated by keytool utility are of type JKS so select this value as "KeyStore type".
























Click Sign It and verify that the document with signature has been generated successfully:





















Now try to open your document with Acrobat Reader. You will notice that the document bears a signature, however it is not recognized by an authority nor it's included in your trust list.


You can either choose to register your certificate on a trust authority (and pay a few hundreds $$) or you can simply upload your certificate and declare it as trusted.
Choose Document | Manage Trusted Identities and choose "Add contacts":


Select "Browse" and point to your "MJ.cer" certificate that we have formerly created. Once that the contact is loaded, click on "Import" at the bottom of the dialog.

Good. Now your certificate will be enlisted among the other certificates available







We are almost done. Select "Edit trust" option and choose to trust the certificate:

Now restart Adobe and open again the document: the signature is valid and trustworthy!
Using a batch script to sign PDFs:
If you have to sign documents as part of a process, you can use as well the JSignPdf.jar library and add the required parameters. (See JSignPdf documentation for more info about it).
Example:
java -jar JSignPdf.jar -kst JKS -ksf mykeystore -ksp mypass C:/documents/sampledoc.pdf