com.ibm.security.smime.jmail
Class PKCS10MimeDataSource

com.ibm.security.smime.jmail.PKCS10MimeDataSource

public class PKCS10MimeDataSource
implements Cloneable

The PKCS10MimeDataSource class provides an object that wraps a CertificationRequest object in a DataSource interface.

See Also:
PKCS10MimeHandler, CertificationRequest

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

Field Detail

CONTENT_TYPE_PKCS10

public static final String CONTENT_TYPE_PKCS10
Constructor Detail

PKCS10MimeDataSource

public PKCS10MimeDataSource(CertificationRequest certRequest)
Create a PKCS10MimeDataSource with the CertificationRequest object.
Parameters:
certRequest - CertificationRequest object.

PKCS10MimeDataSource

public PKCS10MimeDataSource(CertificationRequest certRequest,
                            String provider)
Create a PKCS10MimeDataSource with the CertificationRequest object.
Parameters:
certRequest - CertificationRequest object.
provider - the provider to be used with pkcs.

PKCS10MimeDataSource

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

PKCS10MimeDataSource

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

clone

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

getCertificationRequest

public CertificationRequest getCertificationRequest()
Returns the CertificationRequest object for this PKCS10MimeDataSource object. The CertificateRequest object is immutable.
Returns:
CertificationRequest object

getInputStream

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

getOutputStream

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

getContentType

public String getContentType()
Returns the MIME type of the underlying object. If a CertificationRequest, this method returns "application/x-pkcs10".
Returns:
String content-type of the object.

getName

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

toString

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