|
IAIK CMS/SMIME Toolkit Demo API Documentation
Version 6.1 |
||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectdemo.smime.basic.ProcessMessageDemo
public class ProcessMessageDemo
This class demonstrates the usage of the IAIK S/MIME implementation for cryptographically processing (e.g. signing or encrypting) a received message. Since the message to be processed has a -- already canonicalized -- multipart content, the SMimeMultipart/SMimeBodyPart control can be disabled either globally for the whole application:
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).
mail.jar (JavaMail API).
activation.jar (Java Activation Framework; required for JDK versions < 1.6).
| Constructor Summary | |
|---|---|
ProcessMessageDemo()
Default constructor. |
|
| Method Summary | |
|---|---|
javax.mail.Message |
createCompressedMessage(javax.mail.Session session,
javax.mail.internet.MimeMessage message,
iaik.asn1.structures.AlgorithmID algorithm,
boolean includeHeaders)
Creates a compressed message. |
javax.mail.Message |
createEncryptedMessage(javax.mail.Session session,
javax.mail.internet.MimeMessage message,
iaik.asn1.structures.AlgorithmID algorithm,
int keyLength,
boolean includeHeaders)
Creates an encrypted message. |
javax.mail.Message |
createMessage(javax.mail.Session session,
java.lang.String subject)
Creates a MIME message container with the given subject for the given session. |
javax.mail.Message |
createPlainMessage(javax.mail.Session session,
javax.activation.DataHandler dataHandler)
Creates a simple plain (neither signed nor encrypted) message. |
javax.mail.Message |
createSignedAndEncryptedMessage(javax.mail.Session session,
javax.mail.internet.MimeMessage message,
boolean implicit,
boolean includeHeaders)
Creates a signed and encrypted message. |
javax.mail.Message |
createSignedMessage(javax.mail.Session session,
javax.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. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
public ProcessMessageDemo()
| Method Detail |
|---|
public void start()
throws java.io.IOException
java.io.IOException - if an I/O related error occurs
public javax.mail.Message createMessage(javax.mail.Session session,
java.lang.String subject)
throws javax.mail.MessagingException
session - the mail sesionsubject - the subject of the message
javax.mail.MessagingException - if the message cannot be created
public javax.mail.Message createPlainMessage(javax.mail.Session session,
javax.activation.DataHandler dataHandler)
throws javax.mail.MessagingException
session - the mail sessiondataHandler - the content of the message
javax.mail.MessagingException - if an error occurs when creating the message
public javax.mail.Message createSignedAndEncryptedMessage(javax.mail.Session session,
javax.mail.internet.MimeMessage message,
boolean implicit,
boolean includeHeaders)
throws javax.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
message
javax.mail.MessagingException - if an error occurs when creating the message
public javax.mail.Message createSignedMessage(javax.mail.Session session,
javax.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
message
javax.mail.MessagingException - if an error occurs when creating the message
java.lang.Exception
public javax.mail.Message createEncryptedMessage(javax.mail.Session session,
javax.mail.internet.MimeMessage message,
iaik.asn1.structures.AlgorithmID algorithm,
int keyLength,
boolean includeHeaders)
throws javax.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
message
javax.mail.MessagingException - if an error occurs when creating the message
public javax.mail.Message createCompressedMessage(javax.mail.Session session,
javax.mail.internet.MimeMessage message,
iaik.asn1.structures.AlgorithmID algorithm,
boolean includeHeaders)
throws javax.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
message
javax.mail.MessagingException - if an error occurs when creating the message
public static void main(java.lang.String[] argv)
throws java.io.IOException
java.io.IOException
|
IAIK CMS/SMIME Toolkit Demo API Documentation
Version 6.1 |
||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
|
v6.1 (c) 2002 IAIK, (c) 2003 - 2025 SIC |
|