IAIK CMS/SMIME Toolkit Demo API Documentation
Version 6.1

demo.cms.signedData
Class SignedDataOutputStreamDemo

java.lang.Object
  extended by demo.cms.signedData.SignedDataOutputStreamDemo

public class SignedDataOutputStreamDemo
extends java.lang.Object

Demonstrates the usage of class SignedDataOutputStream and SignedDataOutputStream for signing some data using the CMS type SignedData.


Constructor Summary
SignedDataOutputStreamDemo()
          Setups the demo certificate chains.
 
Method Summary
 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.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

SignedDataOutputStreamDemo

public SignedDataOutputStreamDemo()
                           throws java.io.IOException
Setups the demo certificate chains. Keys and certificate are retrieved from the demo KeyStore.

Throws:
java.io.IOException - if an file read error occurs
Method Detail

createSignedDataStream

public byte[] createSignedDataStream(byte[] message,
                                     int mode)
                              throws iaik.cms.CMSException,
                                     java.io.IOException
Creates and encodes a CMS SignedData object.

Parameters:
message - the message to be signed, as byte representation
mode - the transmission mode, either IMPLICIT or EXPLICIT
Returns:
the BER encoding of the SignedData object just created, wrapped into a ContentInfo
Throws:
iaik.cms.CMSException - if the SignedData object cannot be created
java.io.IOException - if some stream I/O error occurs

getSignedDataStream

public byte[] getSignedDataStream(byte[] signedData,
                                  byte[] message)
                           throws iaik.cms.CMSException,
                                  java.io.IOException
Parses a CMS SignedData object and verifies the signatures for all participated signers.

Parameters:
signedData - SignedData object (wrapped into a ContentInfo) as BER encoded byte array
message - the the message which was transmitted out-of-band (explicit signed)
Returns:
the inherent message as byte array
Throws:
iaik.cms.CMSException - if any signature does not verify
java.io.IOException - if some stream I/O error occurs

start

public void start()
Demonstrates the CMS SignedDataOutputStream implementation.


main

public static void main(java.lang.String[] argv)
                 throws java.lang.Exception
The main method.

Throws:
java.io.IOException - if an I/O error occurs when reading required keys and certificates from files
java.lang.Exception

IAIK CMS/SMIME Toolkit Demo API Documentation
Version 6.1

v6.1
(c) 2002 IAIK, (c) 2003 - 2025 SIC