com.ibm.security.smime.jmail
Class PKCS7MimeHandler

com.ibm.security.smime.jmail.PKCS7MimeHandler

public class PKCS7MimeHandler

The PKCS7MimeHandler class extends the capabilities of the DataHandler's implementation in support of the PKCS7MimeDataSource object.

See Also:
PKCS7MimeDataSource, ContentInfo

Constructor Summary
PKCS7MimeHandler()
           
PKCS7MimeHandler(String provider)
           
 
Method Summary
 Object getContent(DataSource ds)
          Returns the ContentInfo object contained within the DataSource.
 Object getTransferData(DataFlavor df, DataSource ds)
          Returns a ContentInfo object which represents the data to be transferred.
 DataFlavor[] getTransferDataFlavors()
          Returns an array of DataFlavor objects indicating the flavors the data can be provided in.
 String toString()
          Returns a string representation of this PKCS7MimeHandler object.
 void writeTo(Object obj, String mimeType, OutputStream os)
          Convert the ContentInfo object to a DER-encoded byte stream of the supported MIME type and write it to the output stream.
 

Constructor Detail

PKCS7MimeHandler

public PKCS7MimeHandler()

PKCS7MimeHandler

public PKCS7MimeHandler(String provider)
Method Detail

getContent

public Object getContent(DataSource ds)
                  throws IOException
Returns the ContentInfo object contained within the DataSource. For multipart/signed S/MIME PKCS #7 messages, this method will return the ContentInfo without the detached message. For other S/MIME PKCS #7 messages, this method will return the contained ContentInfo object.
Parameters:
ds - DataSource PKCS7MimeDataSource or MimePartDataSource
Returns:
Object ContentInfo or null.
Throws:
IOException - for parsing or messaging errors

getTransferDataFlavors

public DataFlavor[] getTransferDataFlavors()
Returns an array of DataFlavor objects indicating the flavors the data can be provided in. Supported mimetypes are "application/x-pkcs7-mime" and "application/x-pkcs7-signature".
Returns:
Array of DataFlavor objects.

getTransferData

public Object getTransferData(DataFlavor df,
                              DataSource ds)
                       throws UnsupportedFlavorException,
                              IOException
Returns a ContentInfo object which represents the data to be transferred. The DataFlavor mimetype must be one of the supported mimetypes.
Parameters:
df - DataFlavor with a supported mimetype
ds - DataSource of type PKCS7MimeDataSource
Returns:
ContentInfo or null

writeTo

public void writeTo(Object obj,
                    String mimeType,
                    OutputStream os)
             throws IOException
Convert the ContentInfo object to a DER-encoded byte stream of the supported MIME type and write it to the output stream.
Parameters:
obj - ContentInfo
mimeType - mimeType
os - OutputStream

toString

public String toString()
Returns a string representation of this PKCS7MimeHandler object.
Returns:
a string representation of this object.