IAIK CMS/SMIME Toolkit Demo API Documentation
Version 6.1

demo.cms.signedData
Class SignedDataInOutStreamDemoWithAdditionalSignerInfo

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

public class SignedDataInOutStreamDemoWithAdditionalSignerInfo
extends java.lang.Object

This class demonstrates the usage of class SignedDataInOutStream to add a new SignerInfo to an existing, parsed SignedData object.


Constructor Summary
SignedDataInOutStreamDemoWithAdditionalSignerInfo()
          Constructor.
 
Method Summary
 byte[] createSignedDataStream(byte[] message, int mode)
          Creates a CMS SignedData object.
 byte[] getSignedDataStream(byte[] signedData, byte[] message, boolean writeAgain)
          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()
          Starts the test.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

SignedDataInOutStreamDemoWithAdditionalSignerInfo

public SignedDataInOutStreamDemoWithAdditionalSignerInfo()
Constructor. Reads required keys/certs from the demo keystore.

Method Detail

createSignedDataStream

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

Parameters:
message - the message to be signed, as byte representation
mode - the mode indicating whether to include the content (SignedDataStream.IMPLICIT) or not (SignedDataStream.EXPLICIT)
Returns:
the encoding of the SignedData object just created
Throws:
iaik.cms.CMSException - if the SignedData object cannot be created
java.io.IOException - if an I/O error occurs

getSignedDataStream

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

Parameters:
signedData - the SignedData, as BER encoded byte array
message - the message which was transmitted out-of-band (if explicit signed)
writeAgain - whether to add a SignerInfo and encode the SignedData again
Returns:
the inherent message as byte array, or the BER encoded SignedData if it shall be encoded again
Throws:
iaik.cms.CMSException - if any signature does not verify
java.io.IOException - if an I/O error occurs
java.security.NoSuchAlgorithmException

start

public void start()
Starts the test.


main

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

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

IAIK CMS/SMIME Toolkit Demo API Documentation
Version 6.1

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