IAIK CMS/SMIME Toolkit Demo API Documentation
Version 6.1

demo.cms.encryptedData
Class EncryptedDataOutputStreamDemo

java.lang.Object
  extended by demo.cms.encryptedData.EncryptedDataOutputStreamDemo

public class EncryptedDataOutputStreamDemo
extends java.lang.Object

Demonstrates the usage of class EncryptedDataOutputStream for PBE encrypting data using the CMS type EnryptedData.


Constructor Summary
EncryptedDataOutputStreamDemo()
          Default constructor.
 
Method Summary
 byte[] createEncryptedData(byte[] message, char[] password)
          Creates a CMS EncryptedData and wraps it into a ContentInfo.
 byte[] getEncryptedData(byte[] encoding, char[] password)
          Decrypts the encrypted content of the given EncryptedData 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

EncryptedDataOutputStreamDemo

public EncryptedDataOutputStreamDemo()
Default constructor.

Method Detail

createEncryptedData

public byte[] createEncryptedData(byte[] message,
                                  char[] password)
                           throws iaik.cms.CMSException,
                                  java.io.IOException
Creates a CMS EncryptedData and wraps it into a ContentInfo.

Parameters:
message - the message to be encrypted, as byte representation
Returns:
the encoded EncryptedData object just created, wrapped into a ContentInfo
Throws:
iaik.cms.CMSException - if the EncryptedData object cannot be created
java.io.IOException - if an I/O error occurs

getEncryptedData

public byte[] getEncryptedData(byte[] encoding,
                               char[] password)
                        throws iaik.cms.CMSException,
                               java.io.IOException
Decrypts the encrypted content of the given EncryptedData object.

Parameters:
encoding - the encoded EncryptedData object, wrapped in a ContentInfo
password - the password to decrypt the message
Returns:
the recovered message, as byte array
Throws:
iaik.cms.CMSException - if the message cannot be recovered
java.io.IOException - if an I/O error occurs

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 - if an some error occurs

IAIK CMS/SMIME Toolkit Demo API Documentation
Version 6.1

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