com.ibm.security.smime.jmail
Class SMIMEMimeMultipart

com.ibm.security.smime.jmail.SMIMEMimeMultipart

public class SMIMEMimeMultipart

The SMIMEMimeMultipart class supports multipart/signed S/MIME messages where the contents of the message is detached and sent as a separate part with the encoded SignedData object that does not include the contents.


Constructor Summary
SMIMEMimeMultipart()
          Construct an uninitialized SMIMEMimeMultipart object that can be used with the signSignatureOnly method.
SMIMEMimeMultipart(DataSource ds)
          Construct a SMIMEMimeMultipart object with the specified DataSource.
SMIMEMimeMultipart(DataSource ds, String provider)
          Construct a SMIMEMimeMultipart object with the specified DataSource.
SMIMEMimeMultipart(String subtype)
          Construct a SMIMEMimeMultipart object of the given subtype.
SMIMEMimeMultipart(String subtype, String provider)
          Construct a SMIMEMimeMultipart object of the given subtype.
 
Method Summary
 void setProvider(String provider)
          Set the provider.
 void signSignatureOnly(Object message, Certificate signerCert, PrivateKey privateKey, String digestSignatureAlgorithm)
          Signs the message with the specified private key.
 String toString()
          Returns a string representation of this SMIMEMimeMultipart object.
 

Constructor Detail

SMIMEMimeMultipart

public SMIMEMimeMultipart()
Construct an uninitialized SMIMEMimeMultipart object that can be used with the signSignatureOnly method.

SMIMEMimeMultipart

public SMIMEMimeMultipart(DataSource ds)
                   throws com.ibm.security.smime.jmail.MessagingException
Construct a SMIMEMimeMultipart object with the specified DataSource.
Parameters:
ds - DataSource PKCS7MimeDataSource
Throws:
com.ibm.security.smime.jmail.MessagingException - for messaging errors

SMIMEMimeMultipart

public SMIMEMimeMultipart(DataSource ds,
                          String provider)
                   throws com.ibm.security.smime.jmail.MessagingException
Construct a SMIMEMimeMultipart object with the specified DataSource.
Parameters:
ds - DataSource PKCS7MimeDataSource
provider - the provider to be used
Throws:
com.ibm.security.smime.jmail.MessagingException - for messaging errors

SMIMEMimeMultipart

public SMIMEMimeMultipart(String subtype)
Construct a SMIMEMimeMultipart object of the given subtype. The SMIMEMimeMultipart object can be used with the signSignatureOnly method.

SMIMEMimeMultipart

public SMIMEMimeMultipart(String subtype,
                          String provider)
Construct a SMIMEMimeMultipart object of the given subtype. The SMIMEMimeMultipart object can be used with the signSignatureOnly method.
Method Detail

setProvider

public void setProvider(String provider)
Set the provider.
Parameters:
provider - the provider to be used

signSignatureOnly

public void signSignatureOnly(Object message,
                              Certificate signerCert,
                              PrivateKey privateKey,
                              String digestSignatureAlgorithm)
                       throws PKCSException,
                              IOException,
                              NoSuchAlgorithmException,
                              com.ibm.security.smime.jmail.MessagingException
Signs the message with the specified private key. This method adds two parts to the multipart message. First part is the object. The second part is the SignedData object without contents.

This SMIMEMimeMessage object must not already contain a ContentInfo object, otherwise this method will throw a PKCSException.

Parameters:
message - String or Multipart contents to sign
signerCert - certificate of the signer
privateKey - private key of the certificate
digestSignatureAlgorithm - signature algorithm
Throws:
PKCSException - on signing errors
IOException - on signing errors
NoSuchAlgorithmException - on invalid algorithm errors
com.ibm.security.smime.jmail.MessagingException - on message creation errors

toString

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