IAIK CMS/SMIME Toolkit Demo API Documentation
Version 6.1

demo.cms.pkcs7cms
Class PKCS7CMSDigestedDataDemo

java.lang.Object
  extended by demo.cms.pkcs7cms.PKCS7CMSDigestedDataDemo

public class PKCS7CMSDigestedDataDemo
extends java.lang.Object

Compares the usage of IAIK CMS DigestedData(Stream) with IAIK PKSC#7 DigestedData(Stream).


Constructor Summary
PKCS7CMSDigestedDataDemo()
          Default constructor.
 
Method Summary
 iaik.asn1.ASN1Object createDigestedData(byte[] message, int mode)
          Creates a CMS DigestedData object.
 byte[] createDigestedDataStream(byte[] message, int mode)
          Creates a CMS DigestedData object.
 iaik.asn1.ASN1Object createPKCS7DigestedData(byte[] message, int mode)
          Creates a PKCS#7 DigestedData object.
 byte[] createPKCS7DigestedDataStream(byte[] message, int mode)
          Creates a PKCS#7 DigestedData object.
 byte[] getDigestedData(iaik.asn1.ASN1Object obj, byte[] message)
          Parses a CMS DigestedData object and verifies the hash value.
 byte[] getDigestedDataStream(byte[] digestedData, byte[] message)
          Parses a CMS DigestedData object and verifies the hash.
 byte[] getPKCS7DigestedData(iaik.asn1.ASN1Object obj, byte[] message)
          Parses a PKCS#7 DigestedData object and verifies the hash value.
 byte[] getPKCS7DigestedDataStream(byte[] digestedData, byte[] message)
          Parses a PKCS#7 DigestedData object and verifies the hash.
static void main(java.lang.String[] argv)
          Tests the IAIK CMS DigestedData(Stream) implementation against the PKCS#7 DigestedData(Stream) implementation
 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

PKCS7CMSDigestedDataDemo

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

Throws:
java.io.IOException
Method Detail

createDigestedDataStream

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

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

getDigestedDataStream

public byte[] getDigestedDataStream(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 DER encoded byte array
message - the the message which was transmitted out-of-band
Returns:
the inherent message as byte array
Throws:
iaik.cms.CMSException - if any signature does not verify
java.io.IOException - if an I/O error occurs

createDigestedData

public iaik.asn1.ASN1Object createDigestedData(byte[] message,
                                               int mode)
                                        throws iaik.cms.CMSException,
                                               java.io.IOException
Creates a CMS DigestedData object.

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

getDigestedData

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

Parameters:
obj - DigestedData object in ASN.1 representation
message - the the message which was transmitted out-of-band (explicit digested)
Returns:
the message
Throws:
iaik.cms.CMSException - if some parsing exception occurs
java.io.IOException - if an I/O error occurs

createPKCS7DigestedDataStream

public byte[] createPKCS7DigestedDataStream(byte[] message,
                                            int mode)
                                     throws iaik.pkcs.PKCSException,
                                            java.io.IOException
Creates a PKCS#7 DigestedData object.

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

getPKCS7DigestedDataStream

public byte[] getPKCS7DigestedDataStream(byte[] digestedData,
                                         byte[] message)
                                  throws iaik.pkcs.PKCSException,
                                         java.io.IOException
Parses a PKCS#7 DigestedData object and verifies the hash.

Parameters:
digestedData - DigestedData object as DER encoded byte array
message - the the message which was transmitted out-of-band
Returns:
the inherent message as byte array
Throws:
iaik.pkcs.PKCSException - if any signature does not verify
java.io.IOException - if an I/O error occurs

createPKCS7DigestedData

public iaik.asn1.ASN1Object createPKCS7DigestedData(byte[] message,
                                                    int mode)
                                             throws iaik.pkcs.PKCSException,
                                                    java.io.IOException
Creates a PKCS#7 DigestedData object.

Parameters:
message - the message to be digested, as byte representation
mode - IMPLICIT (include message) or EXPLICIT (do not include message)
Returns:
the DigestedData as ASN.1 object
Throws:
iaik.pkcs.PKCSException - if the DigestedData object cannot be created
java.io.IOException - if an I/O error occurs

getPKCS7DigestedData

public byte[] getPKCS7DigestedData(iaik.asn1.ASN1Object obj,
                                   byte[] message)
                            throws iaik.pkcs.PKCSException,
                                   java.io.IOException
Parses a PKCS#7 DigestedData object and verifies the hash value.

Parameters:
obj - DigestedData object in ASN.1 representation
message - the the message which was transmitted out-of-band (explicit digested)
Returns:
the message
Throws:
iaik.pkcs.PKCSException - if some parsing exception occurs
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
Tests the IAIK CMS DigestedData(Stream) implementation against the PKCS#7 DigestedData(Stream) implementation

Throws:
java.lang.Exception

IAIK CMS/SMIME Toolkit Demo API Documentation
Version 6.1

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