public class ProcessMessageDemo extends java.lang.Object
SMimeParameters.setCheckForSMimeParts(false);or only for the specific SignedContent object(s) in use:
SignedContent sc = ...; sc.checkForSMimeParts(false); ...To run this demo the following packages are required:
iaik_cms.jar
(IAIK-CMS/SMIME)
iaik_jce(_full).jar
(IAIK-JCE Core Crypto Library).
Constructor and Description |
---|
ProcessMessageDemo()
Default constructor.
|
Modifier and Type | Method and Description |
---|---|
jakarta.mail.Message |
createCompressedMessage(jakarta.mail.Session session,
jakarta.mail.internet.MimeMessage message,
iaik.asn1.structures.AlgorithmID algorithm,
boolean includeHeaders)
Creates a compressed message.
|
jakarta.mail.Message |
createEncryptedMessage(jakarta.mail.Session session,
jakarta.mail.internet.MimeMessage message,
iaik.asn1.structures.AlgorithmID algorithm,
int keyLength,
boolean includeHeaders)
Creates an encrypted message.
|
jakarta.mail.Message |
createMessage(jakarta.mail.Session session,
java.lang.String subject)
Creates a MIME message container with the given subject for the given session.
|
jakarta.mail.Message |
createPlainMessage(jakarta.mail.Session session,
jakarta.activation.DataHandler dataHandler)
Creates a simple plain (neither signed nor encrypted) message.
|
jakarta.mail.Message |
createSignedAndEncryptedMessage(jakarta.mail.Session session,
jakarta.mail.internet.MimeMessage message,
boolean implicit,
boolean includeHeaders)
Creates a signed and encrypted message.
|
jakarta.mail.Message |
createSignedMessage(jakarta.mail.Session session,
jakarta.mail.internet.MimeMessage message,
boolean implicit,
boolean includeHeaders)
Creates a signed message.
|
static void |
main(java.lang.String[] argv)
The main method.
|
void |
start()
Starts the demo.
|
public ProcessMessageDemo()
public void start() throws java.io.IOException
java.io.IOException
- if an I/O related error occurspublic jakarta.mail.Message createMessage(jakarta.mail.Session session, java.lang.String subject) throws jakarta.mail.MessagingException
session
- the mail sesionsubject
- the subject of the messagejakarta.mail.MessagingException
- if the message cannot be createdpublic jakarta.mail.Message createPlainMessage(jakarta.mail.Session session, jakarta.activation.DataHandler dataHandler) throws jakarta.mail.MessagingException
session
- the mail sessiondataHandler
- the content of the messagejakarta.mail.MessagingException
- if an error occurs when creating the messagepublic jakarta.mail.Message createSignedAndEncryptedMessage(jakarta.mail.Session session, jakarta.mail.internet.MimeMessage message, boolean implicit, boolean includeHeaders) throws jakarta.mail.MessagingException
session
- the mail sessionmessage
- the message to be signed and encryptedimplicit
- whether to use implicit (application/pkcs7-mime) or explicit
(multipart/signed) signingincludeHeaders
- whether to inlcude the RFC822 headers of the original
messagejakarta.mail.MessagingException
- if an error occurs when creating the messagepublic jakarta.mail.Message createSignedMessage(jakarta.mail.Session session, jakarta.mail.internet.MimeMessage message, boolean implicit, boolean includeHeaders) throws java.lang.Exception
session
- the mail sessionmessage
- the message to be signedimplicit
- whether to use implicit (application/pkcs7-mime) or explicit
(multipart/signed) signingincludeHeaders
- whether to inlcude the RFC822 headers of the original
messagejakarta.mail.MessagingException
- if an error occurs when creating the messagejava.lang.Exception
public jakarta.mail.Message createEncryptedMessage(jakarta.mail.Session session, jakarta.mail.internet.MimeMessage message, iaik.asn1.structures.AlgorithmID algorithm, int keyLength, boolean includeHeaders) throws jakarta.mail.MessagingException
session
- the mail sessionmessage
- the message to be encryptedalgorithm
- the content encryption algorithm to be usedkeyLength
- the length of the secret content encryption key to be created and usedincludeHeaders
- whether to inlcude the RFC822 headers of the original
messagejakarta.mail.MessagingException
- if an error occurs when creating the messagepublic jakarta.mail.Message createCompressedMessage(jakarta.mail.Session session, jakarta.mail.internet.MimeMessage message, iaik.asn1.structures.AlgorithmID algorithm, boolean includeHeaders) throws jakarta.mail.MessagingException
session
- the mail sessionmessage
- the message to be compressedalgorithm
- the compression algorithm to be usedincludeHeaders
- whether to inlcude the RFC822 headers of the original
messagejakarta.mail.MessagingException
- if an error occurs when creating the messagepublic static void main(java.lang.String[] argv) throws java.io.IOException
java.io.IOException