com.ibm.security.smime
Class SMIMEMessage

java.lang.Object
  |
  +--com.ibm.security.smime.SMIMEMessage

public final class SMIMEMessage
extends Object
implements Cloneable

The SMIMEMessage class represents a S/MIME message object. Create this object with a S/MIME message from a file or InputStream This class focuses on supporting a limited set of S/MIME messages for PKCS #7 ContentInfo and PKCS #10 CertificationRequest objects. It is not a complete MIME message parser.

This definition reflects the S/MIME Version 2 Message Specification RFC 2311 specifications dated March 1998.


Constructor Summary
SMIMEMessage(byte[] message)
          Create a SMIMEMessage object with a byte array of a S/MIME message.
SMIMEMessage(byte[] message, String provider)
          Create a SMIMEMessage object with a byte array of a S/MIME message.
SMIMEMessage(InputStream in)
          Create a SMIMEMessage object with an InputStream of a S/MIME message.
SMIMEMessage(InputStream in, String provider)
          Create a SMIMEMessage object with an InputStream of a S/MIME message.
SMIMEMessage(String filename)
          Create a SMIMEMessage object with the filename of a S/MIME message.
SMIMEMessage(String filename, String provider)
          Create a SMIMEMessage object with the filename of a S/MIME message.
 
Method Summary
 Object clone()
          Creates a clone of this SMIMEMessage object.
 byte[] getBody()
          Returns a copy of the body of this SMIMEMessage object as a byte array.
 byte[] getBytes()
          Returns a copy the message of this SMIMEMessage object as a byte array of the header and body.
 CertificationRequest getCertificationRequest()
          Returns a copy of the CertificationRequest contained in this SMIMEMessage object.
 byte[] getCertificationRequestBytes()
          Returns a copy of the byte array representing the BASE64 encoding of the CertificationRequest contained in this SMIMEMessage object.
 ContentInfo getContentInfo()
          Returns a copy of the ContentInfo contained in this SMIMEMessage object.
 byte[] getContentInfoBytes()
          Returns a copy of the byte array representing the BASE64 encoding of the ContentInfo contained in this SMIMEMessage object.
 byte[] getHeader()
          Returns a copy of the header of this SMIMEMessage object as a byte array.
 Hashtable getHeaderHashTable()
          Returns the Hashtable representing the header of this SMIMEMessage object.
 byte[] getMessage()
          Returns a copy of the byte array representing the message of this SMIMEMessage object.
 String toString()
          Returns a string representation of this SMIMEMessage object.
 
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

SMIMEMessage

public SMIMEMessage(byte[] message)
             throws IOException
Create a SMIMEMessage object with a byte array of a S/MIME message.
Parameters:
message - a byte array of a S/MIME message.
Throws:
IOException - on parsing errors.

SMIMEMessage

public SMIMEMessage(byte[] message,
                    String provider)
             throws IOException
Create a SMIMEMessage object with a byte array of a S/MIME message.
Parameters:
message - a byte array of a S/MIME message.
provider - the provider to be used with pkcs.
Throws:
IOException - on parsing errors.

SMIMEMessage

public SMIMEMessage(InputStream in)
             throws IOException
Create a SMIMEMessage object with an InputStream of a S/MIME message.
Parameters:
in - an InputStream containing a S/MIME message.
Throws:
IOException - on parsing errors.

SMIMEMessage

public SMIMEMessage(InputStream in,
                    String provider)
             throws IOException
Create a SMIMEMessage object with an InputStream of a S/MIME message.
Parameters:
in - an InputStream containing a S/MIME message.
provider - the provider to be used with pkcs.
Throws:
IOException - on parsing errors.

SMIMEMessage

public SMIMEMessage(String filename)
             throws IOException
Create a SMIMEMessage object with the filename of a S/MIME message.
Parameters:
filename - a name of a file containing the S/MIME message.
Throws:
IOException - on parsing errors.

SMIMEMessage

public SMIMEMessage(String filename,
                    String provider)
             throws IOException
Create a SMIMEMessage object with the filename of a S/MIME message.
Parameters:
filename - a name of a file containing the S/MIME message.
provider - the provider to be used with pkcs.
Throws:
IOException - on parsing errors.
Method Detail

clone

public Object clone()
Creates a clone of this SMIMEMessage object.
Overrides:
clone in class Object
Returns:
clone of this SMIMEMessage object.

getBytes

public byte[] getBytes()
                throws IOException
Returns a copy the message of this SMIMEMessage object as a byte array of the header and body.
Returns:
Byte array of the S/MIME message.
Throws:
IOException - on parsing errors.

getHeader

public byte[] getHeader()
Returns a copy of the header of this SMIMEMessage object as a byte array.
Returns:
Byte array of the S/MIME message header.

getHeaderHashTable

public Hashtable getHeaderHashTable()
Returns the Hashtable representing the header of this SMIMEMessage object.
Returns:
Hashtable of the S/MIME message header.

getBody

public byte[] getBody()
Returns a copy of the body of this SMIMEMessage object as a byte array.
Returns:
Byte array of the S/MIME message body.

getMessage

public byte[] getMessage()
Returns a copy of the byte array representing the message of this SMIMEMessage object.
Returns:
the byte array representing the message of the S/MIME message

getContentInfoBytes

public byte[] getContentInfoBytes()
Returns a copy of the byte array representing the BASE64 encoding of the ContentInfo contained in this SMIMEMessage object.
Returns:
the byte array representing the BASE64 encoding of the contained ContentInfo or null if the SMIMEMessage object did not contain a ContentInfo

getContentInfo

public ContentInfo getContentInfo()
                           throws IOException
Returns a copy of the ContentInfo contained in this SMIMEMessage object.
Returns:
the ContentInfo contained in this SMIMEMessage object or null if the SMIMEMessage object did not contain a ContentInfo

getCertificationRequestBytes

public byte[] getCertificationRequestBytes()
Returns a copy of the byte array representing the BASE64 encoding of the CertificationRequest contained in this SMIMEMessage object.
Returns:
the byte array representing the BASE64 encoding of the contained CertificationRequest or null if the SMIMEMessage object did not contain a CertificationRequest

getCertificationRequest

public CertificationRequest getCertificationRequest()
                                             throws IOException
Returns a copy of the CertificationRequest contained in this SMIMEMessage object.
Returns:
the CertificationRequest contained in this SMIMEMessage object or null if the SMIMEMessage object did not contain a CertificationRequest

toString

public String toString()
Returns a string representation of this SMIMEMessage object.
Overrides:
toString in class Object
Returns:
a string representation of this object.