IAIK CMS/SMIME Toolkit Demo API Documentation
Version 6.1

demo.cms.digestedData
Class DigestedDataOutputStreamDemo

java.lang.Object
  extended by demo.cms.digestedData.DigestedDataOutputStreamDemo

public class DigestedDataOutputStreamDemo
extends java.lang.Object

Demonstrates the usage of class DigestedDataOutputStream and DigestedData for digesting data using the CMS type DigestedData.


Constructor Summary
DigestedDataOutputStreamDemo()
          Default constructor.
 
Method Summary
 byte[] createDigestedData(byte[] message, int mode)
          Uses the IAIK-CMS DigestedDataOutputStream class to create a CMS DigestedData object for digesting the given message.
 byte[] getDigestedData(byte[] digestedData, byte[] message)
          Parses a CMS DigestedData object and verifies the hash.
static void main(java.lang.String[] argv)
          Main method.
 void start()
          Starts the tests.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

DigestedDataOutputStreamDemo

public DigestedDataOutputStreamDemo()
                             throws java.io.IOException
Default constructor.

Throws:
java.io.IOException
Method Detail

createDigestedData

public byte[] createDigestedData(byte[] message,
                                 int mode)
                          throws iaik.cms.CMSException,
                                 java.io.IOException
Uses the IAIK-CMS DigestedDataOutputStream class to create a CMS DigestedData object for digesting the given message.

Parameters:
message - the message to be digested, as byte representation
mode - IMPLICIT (include message) or EXPLICIT (do not include message)
Returns:
the BER encoding of the DigestedData object just created, wrapped in a ContentInfo
Throws:
iaik.cms.CMSException - if the DigestedData object cannot be created
java.io.IOException - if an I/O error occurs

getDigestedData

public byte[] getDigestedData(byte[] digestedData,
                              byte[] message)
                       throws iaik.cms.CMSException,
                              java.io.IOException
Parses a CMS DigestedData object and verifies the hash.

Parameters:
digestedData - DigestedData object as BER encoded byte array
message - the message which may have been transmitted out-of-band
Returns:
the inherent message as byte array
Throws:
iaik.cms.CMSException - if some parsing error occurs or the hash verification fails
java.io.IOException - if an I/O error occurs

start

public void start()
Starts the tests.


main

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

Throws:
java.lang.Exception

IAIK CMS/SMIME Toolkit Demo API Documentation
Version 6.1

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