com.ibm.security.smime.jmail
Class PKCS7MimeDataSource

com.ibm.security.smime.jmail.PKCS7MimeDataSource

public class PKCS7MimeDataSource
implements Cloneable

The PKCS7MimeDataSource class provides an object that wraps a ContentInfo object in a DataSource interface.

See Also:
PKCS7MimeHandler, ContentInfo

Field Summary
static String CONTENT_TYPE_PKCS7
           
static String CONTENT_TYPE_PKCS7_SIGNATURE
           
 
Constructor Summary
PKCS7MimeDataSource(byte[] encoding, boolean base64)
          Create a PKCS7MimeDataSource with the byte array of the DER-encoded or BASE64-encoded ContentInfo object.
PKCS7MimeDataSource(byte[] encoding, boolean base64, String provider)
          Create a PKCS7MimeDataSource with the byte array of the DER-encoded or BASE64-encoded ContentInfo object.
PKCS7MimeDataSource(ContentInfo contentInfo)
          Create a PKCS7MimeDataSource with the ContentInfo object.
PKCS7MimeDataSource(ContentInfo contentInfo, String provider)
          Create a PKCS7MimeDataSource with the ContentInfo object.
 
Method Summary
 Object clone()
          Creates a clone of this PKCS7MimeDataSource object.
 ContentInfo getContentInfo()
          Returns a clone of the ContentInfo object contained in this PKCS7MimeDataSource object.
 String getContentType()
          Returns the MIME type of the underlying object.
 InputStream getInputStream()
          This method returns a ByteArrayInputStream representing the DER encoding of the ContentInfo object.
 String getName()
          Returns the name of the underlying ContentInfo object type.
 OutputStream getOutputStream()
          This method returns a ByteArrayOutputStream to which the DER encoding of the ContentInfo object can be written..
 String toString()
          Returns a string representation of this PKCS7MimeDataSource object consisting of the contained ContentInfo object.
 

Field Detail

CONTENT_TYPE_PKCS7

public static final String CONTENT_TYPE_PKCS7

CONTENT_TYPE_PKCS7_SIGNATURE

public static final String CONTENT_TYPE_PKCS7_SIGNATURE
Constructor Detail

PKCS7MimeDataSource

public PKCS7MimeDataSource(ContentInfo contentInfo)
Create a PKCS7MimeDataSource with the ContentInfo object.
Parameters:
contentInfo - ContentInfo object.

PKCS7MimeDataSource

public PKCS7MimeDataSource(ContentInfo contentInfo,
                           String provider)
Create a PKCS7MimeDataSource with the ContentInfo object.
Parameters:
contentInfo - ContentInfo object.
provider - the provider to be used with pkcs.

PKCS7MimeDataSource

public PKCS7MimeDataSource(byte[] encoding,
                           boolean base64)
                    throws IOException
Create a PKCS7MimeDataSource with the byte array of the DER-encoded or BASE64-encoded ContentInfo object.
Parameters:
encoding - byte array of the DER-encoded or base64-encoded ContentInfo object
base64 - true if BASE64-encoded, false if DER-encoded
Throws:
IOException - on decoding errors.

PKCS7MimeDataSource

public PKCS7MimeDataSource(byte[] encoding,
                           boolean base64,
                           String provider)
                    throws IOException
Create a PKCS7MimeDataSource with the byte array of the DER-encoded or BASE64-encoded ContentInfo object.
Parameters:
encoding - byte array of the DER-encoded or base64-encoded ContentInfo object
base64 - true if BASE64-encoded, false if DER-encoded
provider - the provider to be used
Throws:
IOException - on decoding errors.
Method Detail

clone

public Object clone()
Creates a clone of this PKCS7MimeDataSource object.
Returns:
clone of this PKCS7MimeDataSource object.

getContentInfo

public ContentInfo getContentInfo()
Returns a clone of the ContentInfo object contained in this PKCS7MimeDataSource object.
Returns:
ContentInfo object or null

getInputStream

public InputStream getInputStream()
                           throws IOException
This method returns a ByteArrayInputStream representing the DER encoding of the ContentInfo object.
Returns:
ByteArrayInputStream or null

getOutputStream

public OutputStream getOutputStream()
                             throws IOException
This method returns a ByteArrayOutputStream to which the DER encoding of the ContentInfo object can be written..
Returns:
ByteArrayOutputStream

getContentType

public String getContentType()
Returns the MIME type of the underlying object. If a signature-only ContentInfo object for a multipart/signed message, this method returns "application/x-pkcs7-signature". If any other ContentInfo object, this method returns "application/x-pkcs7-mime".
Returns:
String content-type of the object.

getName

public String getName()
Returns the name of the underlying ContentInfo object type.
Returns:
String Name of the ContentInfo object type.

toString

public String toString()
Returns a string representation of this PKCS7MimeDataSource object consisting of the contained ContentInfo object.
Returns:
a string representation of this object.