IAIK CMS/SMIME Toolkit Demo API Documentation
Version 6.1

demo.cms.compressedData
Class CompressedDataDemo

java.lang.Object
  extended by demo.cms.compressedData.CompressedDataDemo

public class CompressedDataDemo
extends java.lang.Object

Demonstrates the usage of class CompressedDataStream and CompressedData for compressing/decompressing data using the CMS type CompressedData.


Constructor Summary
CompressedDataDemo()
          Default constructor.
 
Method Summary
 byte[] createCompressedData(byte[] message, int mode)
          Creates a CMS CompressedData object.
 byte[] createCompressedDataStream(byte[] message, int mode)
          Creates a CMS CompressedData object.
 byte[] getCompressedData(byte[] encoding, byte[] compressedContent)
          Parses a CMS CompressedData object.
 byte[] getCompressedDataStream(byte[] encoding, byte[] compressedContent)
          Parses a CMS CompressedData object.
static void main(java.lang.String[] argv)
          Main method.
 void start()
          Starts the demo.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

CompressedDataDemo

public CompressedDataDemo()
Default constructor.

Method Detail

createCompressedDataStream

public byte[] createCompressedDataStream(byte[] message,
                                         int mode)
                                  throws iaik.cms.CMSException,
                                         java.io.IOException,
                                         java.security.NoSuchAlgorithmException
Creates a CMS CompressedData object.

Parameters:
message - the message to be compressed, as byte representation
mode - IMPLICIT (include compressed content) or EXPLICIT (do not include compressed content)
Returns:
the BER encoding of the CompressedData object just created
Throws:
iaik.cms.CMSException - if the CompressedData object cannot be created
java.io.IOException - if an I/O error occurs
java.security.NoSuchAlgorithmException - if the compression algorithm is not supported

getCompressedDataStream

public byte[] getCompressedDataStream(byte[] encoding,
                                      byte[] compressedContent)
                               throws iaik.cms.CMSException,
                                      java.io.IOException,
                                      java.security.NoSuchAlgorithmException
Parses a CMS CompressedData object.

Parameters:
encoding - the CompressedData object as BER encoded byte array
compressedContent - the compressed content which was transmitted out-of-band
Returns:
the decompressed message as byte array
Throws:
iaik.cms.CMSException - if the CompressedData cannot be parsed
java.io.IOException - if an I/O error occurs
java.security.NoSuchAlgorithmException - if the compression algorithm is not supported

createCompressedData

public byte[] createCompressedData(byte[] message,
                                   int mode)
                            throws iaik.cms.CMSException,
                                   java.io.IOException,
                                   java.security.NoSuchAlgorithmException
Creates a CMS CompressedData object.

Parameters:
message - the message to be compressed, as byte representation
mode - IMPLICIT (include the compressed content) or EXPLICIT (do not include the compressed content)
Returns:
the DER encoded CompressedData
Throws:
iaik.cms.CMSException - if the CompressedData object cannot be created
java.io.IOException - if an I/O error occurs
java.security.NoSuchAlgorithmException - if the compression algorithm is not supported

getCompressedData

public byte[] getCompressedData(byte[] encoding,
                                byte[] compressedContent)
                         throws iaik.cms.CMSException,
                                java.io.IOException,
                                java.security.NoSuchAlgorithmException
Parses a CMS CompressedData object.

Parameters:
encoding - the DER encoded CompressedData object
compressedContent - the compressed content which was transmitted out-of-band
Returns:
the decompressed message as byte array
Throws:
iaik.cms.CMSException - if the CompressedData cannot be parsed
java.io.IOException - if an I/O error occurs
java.security.NoSuchAlgorithmException - if the compression algorithm is not supported

start

public void start()
Starts the demo.


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