Adding multiple digital signatures to text.

Sep 16 2014 12:54 AM
I am following this article to add a digital signature to simple text. I have a requirement where I want multiple signatures to be added to the same text. There are two mechanisms that we want to support.
 
Suppose, we are given a plain text message m of arbitrary length of bytes. Then, the two mechanisms are follows.
 
1. Sign m with signature d1 to result signed text s1. Send s1 to another party who will then sign it with d2 to result signed text s2. This can go on for a few more times.
 
2.  Sign m with signature d1 to result signed text s1. Send s1 to another party who will then sign it with d2, only if it has verified that signature of s1 exists, to result signed text s2. This can go on for a few more times.
 
Thus, in first case, signatures are appended as and when text to sign arrives. In second case, signatures are appended only if a prior signature exists.
 
Finally, at the end of either of the mechanisms mentioned above, the receiver should be able to list out the signing entities for auditing purposes.
 
I am still getting used to concept of signatures and certificates usage in Java; so, a newbie here. Can you please guide me how to achieve this requirement ?