|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
com.ibm.security.smime.jmail.SMIMEMimeMessage
This class allows construction of SMIMEMimeMessage objects that can be used to send S/MIME PKCS #7 and #10 messages.
S/MIME PKCS #7 messages include:
S/MIME PKCS #7 messages utilize the PKCS7MimeDataSource and PKCS7MimeHandler classes. Use the SMIMEMimeMultipart class to send a multipart/signed message with detached contents.
S/MIME PKCS #10 messages are used to send CertificationRequest objects and these messages utilize the PKCS10MimeDataSource and PKCS10MimeHandler classes.
SMIME
,
SMIMEMimeMultipart
,
PKCS7MimeDataSource
,
PKCS7MimeHandler
,
PKCS10MimeDataSource
,
PKCS10MimeHandler
Constructor Summary | |
protected |
SMIMEMimeMessage(com.ibm.security.smime.jmail.Folder folder,
InputStream is,
int msgnum)
Constructs a MimeMessage by reading and parsing the data from the specified MIME InputStream. |
protected |
SMIMEMimeMessage(com.ibm.security.smime.jmail.Folder folder,
InputStream is,
int msgnum,
String provider)
Constructs a MimeMessage by reading and parsing the data from the specified MIME InputStream. |
protected |
SMIMEMimeMessage(com.ibm.security.smime.jmail.Folder folder,
int msgnum)
Constructs an empty MimeMessage object with the given Folder and message number. |
protected |
SMIMEMimeMessage(com.ibm.security.smime.jmail.Folder folder,
com.ibm.security.smime.jmail.InternetHeaders headers,
byte[] content,
int msgnum)
Constructs a MimeMessage from the given InternetHeaders object and content. |
protected |
SMIMEMimeMessage(com.ibm.security.smime.jmail.Folder folder,
com.ibm.security.smime.jmail.InternetHeaders headers,
byte[] content,
int msgnum,
String provider)
Constructs a MimeMessage from the given InternetHeaders object and content. |
protected |
SMIMEMimeMessage(com.ibm.security.smime.jmail.Folder folder,
int msgnum,
String provider)
Constructs an empty MimeMessage object with the given Folder and message number. |
|
SMIMEMimeMessage(com.ibm.security.smime.jmail.Session session)
Default constructor. |
|
SMIMEMimeMessage(com.ibm.security.smime.jmail.Session session,
InputStream is)
Constructs a MimeMessage by reading and parsing the data from the specified MIME InputStream. |
|
SMIMEMimeMessage(com.ibm.security.smime.jmail.Session session,
InputStream is,
String provider)
Constructs a MimeMessage by reading and parsing the data from the specified MIME InputStream. |
|
SMIMEMimeMessage(com.ibm.security.smime.jmail.Session session,
String provider)
Default constructor. |
Method Summary | |
void |
addRecipientCertificate(Certificate[] certs)
Add an array of recipient certificates to the S/MIME message. |
ContentInfo |
decrypt(PrivateKey recipientPrivateKey,
Certificate recipientCert)
Decrypts the ContentInfo that contains an EnvelopedData object for this SMIMEMimeMessage object. |
void |
encrypt(Object message,
int encryptionStrength)
Encrypts the message with a generated secret key and encrypts the secret key with the recipient certificate(s) that were already specified for this SMIMEMimeMessage object. |
void |
encrypt(Object message,
String encryptionAlgorithm,
int keySize)
Encrypts the message with a generated secret key and encrypts the secret key with the recipient certificate(s) that were already specified for this SMIMEMimeMessage object. |
CertificationRequest |
getCertificationRequest()
Returns the CertificationRequest object contained within this SMIMEMimeMessage, if any. |
ContentInfo |
getContentInfo()
Returns a copy of the ContentInfo object contained within this SMIMEMimeMessage, if any. |
boolean |
isCertificationRequest()
Returns whether or not this SMIMEMimeMessage is a pkcs10 message. |
boolean |
isEnvelopedData()
Returns whether or not this SMIMEMimeMessage is an enveloped-data message. |
boolean |
isSignedData()
Returns whether or not this SMIMEMimeMessage is a signed-data message. |
boolean |
isSignedDataCertificateOnly()
Returns whether or not this SMIMEMimeMessage is a certs-only message. |
boolean |
isSignedDataSignatureOnly()
Returns whether or not this SMIMEMimeMessage is a multipart/signed message. |
void |
setCertificateOnly(Certificate[] certs)
Set the content of this SMIMEMimeMessage object to a certificate-only SignedData object with the specified certificate array. |
void |
setCertificationRequest(CertificationRequest certRequest)
Set the CertificationRequest object for this SMIMEMimeMessage object. |
void |
setRecipientCertificate(Certificate[] certs)
Set the recipient certificates for the S/MIME message. |
void |
sign(Object message,
Certificate signerCert,
PrivateKey privateKey,
String digestSignatureAlgorithm)
Signs the message with the specified private key. |
String |
toString()
Returns a string representation of this SMIMEMimeMessage object. |
boolean |
verify(Certificate signerCert)
Verifies the ContentInfo that contains a SignedData object for this SMIMEMimeMessage object. |
boolean |
verify(Certificate signerCert,
byte[] msg)
Verifies the ContentInfo that contains a SignedData object for this SMIMEMimeMessage object. |
Constructor Detail |
protected SMIMEMimeMessage(com.ibm.security.smime.jmail.Folder folder, InputStream is, int msgnum) throws com.ibm.security.smime.jmail.MessagingException
protected SMIMEMimeMessage(com.ibm.security.smime.jmail.Folder folder, InputStream is, int msgnum, String provider) throws com.ibm.security.smime.jmail.MessagingException
protected SMIMEMimeMessage(com.ibm.security.smime.jmail.Folder folder, int msgnum) throws com.ibm.security.smime.jmail.MessagingException
protected SMIMEMimeMessage(com.ibm.security.smime.jmail.Folder folder, int msgnum, String provider) throws com.ibm.security.smime.jmail.MessagingException
protected SMIMEMimeMessage(com.ibm.security.smime.jmail.Folder folder, com.ibm.security.smime.jmail.InternetHeaders headers, byte[] content, int msgnum) throws com.ibm.security.smime.jmail.MessagingException
protected SMIMEMimeMessage(com.ibm.security.smime.jmail.Folder folder, com.ibm.security.smime.jmail.InternetHeaders headers, byte[] content, int msgnum, String provider) throws com.ibm.security.smime.jmail.MessagingException
public SMIMEMimeMessage(com.ibm.security.smime.jmail.Session session)
public SMIMEMimeMessage(com.ibm.security.smime.jmail.Session session, String provider)
public SMIMEMimeMessage(com.ibm.security.smime.jmail.Session session, InputStream is) throws com.ibm.security.smime.jmail.MessagingException
public SMIMEMimeMessage(com.ibm.security.smime.jmail.Session session, InputStream is, String provider) throws com.ibm.security.smime.jmail.MessagingException
Method Detail |
public boolean isSignedDataSignatureOnly()
public boolean isSignedDataCertificateOnly()
public boolean isSignedData()
public boolean isEnvelopedData()
public boolean isCertificationRequest()
public void setCertificationRequest(CertificationRequest certRequest) throws com.ibm.security.smime.jmail.MessagingException, PKCSException
This SMIMEMimeMessage object must not already contain a ContentInfo or CertificationRequest object, otherwise this method will throw a PKCSException.
certRequest
- CertificationRequest objectpublic void addRecipientCertificate(Certificate[] certs)
certs
- Certificate arraypublic void setRecipientCertificate(Certificate[] certs)
certs
- Certificate arraypublic void setCertificateOnly(Certificate[] certs) throws PKCSException, IOException, NoSuchAlgorithmException, com.ibm.security.smime.jmail.MessagingException
This SMIMEMimeMessage object must not already contain a ContentInfo or CertificationRequest object, otherwise this method will throw a PKCSException.
certs
- Certificate arraypublic void sign(Object message, Certificate signerCert, PrivateKey privateKey, String digestSignatureAlgorithm) throws PKCSException, IOException, NoSuchAlgorithmException, com.ibm.security.smime.jmail.MessagingException
This SMIMEMimeMessage object must not already contain a ContentInfo or CertificationRequest object, otherwise this method will throw a PKCSException.
message
- String or Multipart contents to signsignerCert
- certificate of the signerprivateKey
- private key of the certificatedigestSignatureAlgorithm
- signature algorithmpublic void encrypt(Object message, int encryptionStrength) throws PKCSException, IOException, NoSuchAlgorithmException, com.ibm.security.smime.jmail.MessagingException
This SMIMEMimeMessage object must not already contain a ContentInfo or CertificationRequest object, otherwise this method will throw a PKCSException. This method requires that the recipient certificate(s) must have been previously set on this SMIMEMimeMessage object.
message
- String or Multipart contents to encryptencryptionStrength
- specified by SMIME.WEAK_ENCRYPTION,
SMIME.MEDIUM_ENCRYPTION, or SMIME.STRONG_ENCRYPTIONpublic void encrypt(Object message, String encryptionAlgorithm, int keySize) throws PKCSException, IOException, NoSuchAlgorithmException, com.ibm.security.smime.jmail.MessagingException
This SMIMEMimeMessage object must not already contain a ContentInfo or CertificationRequest object, otherwise this method will throw a PKCSException. This method requires that the recipient certificate(s) must have been previously set on this SMIMEMimeMessage object.
message
- String or Multipart contents to encryptencryptionAlgorithm
- encryption algorithm StringkeySize
- length of the encryption keypublic boolean verify(Certificate signerCert) throws PKCSException, IOException, NoSuchAlgorithmException
This method will attempt to use the multipart message stored with this SMIMEMimeMessage object for signed, multipart messages. Otherwise, this method will attempt to use any stored contents within the message or SignedData object.
signerCert
- certificate of the signerpublic boolean verify(Certificate signerCert, byte[] msg) throws PKCSException, IOException, NoSuchAlgorithmException
signerCert
- certificate of the signermsg
- byte array to compute the message digest comparision.
If not specified, this method will attempt to use the multipart message
stored with this SMIMEMimeMessage object for signed, multipart messages.
If not specified, this method will attempt to use any stored
contents within the message or SignedData object.public ContentInfo decrypt(PrivateKey recipientPrivateKey, Certificate recipientCert) throws IOException, PKCSException, com.ibm.security.smime.jmail.MessagingException
recipientPrivateKey
- private key of the recipientrecipientCert
- certificate of the recipientpublic ContentInfo getContentInfo()
public CertificationRequest getCertificationRequest()
public String toString()
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |