public class BigSMimeMailDemo extends java.lang.Object
The only difference to the common usage of this S/MIME library is that
this demo uses a temporary file directory to which the content of the
big messages is written during processing. The temporary directory is
created by calling method SMimeParameters#setTempDirectory
:
int bufSize = 16348; String tmpDir = ...; SMimeParameters.setTempDirectory(tmpDir, bufSize);See Javadoc of
SMimeParameters#setTempDirectory
for usage information.
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 |
---|
BigSMimeMailDemo()
Default constructor.
|
Modifier and Type | Method and Description |
---|---|
jakarta.mail.Message |
createCompressedMessage(jakarta.mail.Session session,
jakarta.activation.DataHandler dataHandler,
iaik.asn1.structures.AlgorithmID algorithm)
Creates a compressed message.
|
jakarta.mail.Message |
createEncryptedMessage(jakarta.mail.Session session,
jakarta.activation.DataHandler dataHandler,
iaik.asn1.structures.AlgorithmID algorithm,
int keyLength,
boolean authEncrypt)
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 |
createSignedAndEncryptedMessage(jakarta.mail.Session session,
jakarta.activation.DataHandler dataHandler,
iaik.asn1.structures.AlgorithmID algorithm,
int keyLength,
boolean implicit,
boolean authEncrypt)
Creates a signed and encrypted message.
|
jakarta.mail.Message |
createSignedMessage(jakarta.mail.Session session,
jakarta.activation.DataHandler dataHandler,
boolean implicit)
Creates a signed message.
|
static void |
main(java.lang.String[] argv)
The main method.
|
void |
parse(java.lang.Object o)
Parses the given object (message, part, ... ).
|
void |
start()
Starts the demo.
|
public BigSMimeMailDemo()
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 createSignedAndEncryptedMessage(jakarta.mail.Session session, jakarta.activation.DataHandler dataHandler, iaik.asn1.structures.AlgorithmID algorithm, int keyLength, boolean implicit, boolean authEncrypt) throws jakarta.mail.MessagingException
session
- the mail sessiondataHandler
- the content of the message to be signed and encryptedalgorithm
- the content encryption algorithm to be usedkeyLength
- the length of the secret content encryption key to be created and usedimplicit
- whether to use implicit (application/pkcs7-mime) or explicit
(multipart/signed) signingauthEncrypt
- whether to create an authenticated encrypted or an encrypted messagejakarta.mail.MessagingException
- if an error occurs when creating the messagepublic jakarta.mail.Message createSignedMessage(jakarta.mail.Session session, jakarta.activation.DataHandler dataHandler, boolean implicit) throws jakarta.mail.MessagingException
session
- the mail sessiondataHandler
- the content of the message to be signedimplicit
- whether to use implicit (application/pkcs7-mime) or explicit
(multipart/signed) signingjakarta.mail.MessagingException
- if an error occurs when creating the messagepublic jakarta.mail.Message createEncryptedMessage(jakarta.mail.Session session, jakarta.activation.DataHandler dataHandler, iaik.asn1.structures.AlgorithmID algorithm, int keyLength, boolean authEncrypt) throws jakarta.mail.MessagingException
session
- the mail sessiondataHandler
- the dataHandler providing the content to be encryptedalgorithm
- the content encryption algorithm to be usedkeyLength
- the length of the secret content encryption key to be created and usedauthEncrypt
- whether to create an authenticated encrypted or an encrypted messagejakarta.mail.MessagingException
- if an error occurs when creating the messagepublic jakarta.mail.Message createCompressedMessage(jakarta.mail.Session session, jakarta.activation.DataHandler dataHandler, iaik.asn1.structures.AlgorithmID algorithm) throws jakarta.mail.MessagingException
session
- the mail sessiondataHandler
- the datahandler supplying the content to be compressedalgorithm
- the compression algorithm to be usedjakarta.mail.MessagingException
- if an error occurs when creating the messagepublic void parse(java.lang.Object o) throws java.lang.Exception
o
- the object (message, part, ... ) to be parsedjava.lang.Exception
- if an exception occurs while parsingpublic static void main(java.lang.String[] argv) throws java.io.IOException
java.io.IOException