public class SignedDataOutputStreamDemo extends java.lang.Object
SignedDataOutputStream and
SignedDataOutputStream for signing some data using the CMS type
SignedData.| Constructor and Description |
|---|
SignedDataOutputStreamDemo()
Setups the demo certificate chains.
|
| Modifier and Type | Method and Description |
|---|---|
byte[] |
createSignedDataStream(byte[] message,
int mode)
Creates and encodes a CMS
SignedData object. |
byte[] |
getSignedDataStream(byte[] signedData,
byte[] message)
Parses a CMS
SignedData object and verifies the signatures
for all participated signers. |
static void |
main(java.lang.String[] argv)
The main method.
|
void |
start()
Demonstrates the CMS SignedDataOutputStream implementation.
|
public SignedDataOutputStreamDemo() throws java.io.IOException
java.io.IOException - if an file read error occurspublic byte[] createSignedDataStream(byte[] message, int mode) throws iaik.cms.CMSException, java.io.IOException
SignedData object.
message - the message to be signed, as byte representationmode - the transmission mode, either IMPLICIT or EXPLICITSignedData object just created, wrapped into a ContentInfoiaik.cms.CMSException - if the SignedData object cannot
be createdjava.io.IOException - if some stream I/O error occurspublic byte[] getSignedDataStream(byte[] signedData, byte[] message) throws iaik.cms.CMSException, java.io.IOException
SignedData object and verifies the signatures
for all participated signers.signedData - SignedData object (wrapped into a ContentInfo) as BER encoded byte arraymessage - the the message which was transmitted out-of-band (explicit signed)iaik.cms.CMSException - if any signature does not verifyjava.io.IOException - if some stream I/O error occurspublic void start()
public static void main(java.lang.String[] argv) throws java.lang.Exception
java.io.IOException - if an I/O error occurs when reading required keys
and certificates from filesjava.lang.Exception