IAIK CMS/SMIME Toolkit Demo API Documentation
Version 6.1

demo.smime.ess
Class SecurityLabelDemo

java.lang.Object
  extended by demo.smime.ess.SecurityLabelDemo

public class SecurityLabelDemo
extends java.lang.Object

Demonstrates the usage of the S/MIME-ESS SecurityLabel attribute. The SecurityLabel attribute may be included as signed attribute in a SignerInfo for providing some kind of "access control" mechanism for the contents of a message.

This demo uses a simple SecurityLabelHandler that only implements a simple security policy based on the default security classifications "unmarked", "unclassified", "restricted", "confidential", "secret", "top-secret". Since the SignedData message created by this demo only contains an ESS SecurityLabel attribute with classification "confidential", only this classification is processed by the demo handler. "unmarked" and "unclassified" are handled as "not critical" content (i.e. the content can be accessed by any one), "secret", "top-secret" lock the content (i.e. it is not displayed), and "restricted" and "confidential" popup a confirmation dialog reminding the recipient about the confidentiality of the message content.

To run this demo the following packages are required:

See Also:
MySecurityLabelHandler, ESSSecurityLabel

Constructor Summary
SecurityLabelDemo()
          Default constructor.
 
Method Summary
 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 createSignedMessage(javax.mail.Session session)
          Creates a signed message containing an ESS SecurityLabel attribute.
static void main(java.lang.String[] argv)
          The main method.
 void parseMessage(javax.mail.Message msg)
          Parses the signed message, verifies the signature and processes the SecurityLabel attribute.
 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

SecurityLabelDemo

public SecurityLabelDemo()
Default constructor. Reads certificates and keys from the demo keystore.

Method Detail

start

public void start()
           throws java.io.IOException
Starts the demo.

Throws:
java.io.IOException - if an I/O related error occurs

createMessage

public javax.mail.Message createMessage(javax.mail.Session session,
                                        java.lang.String subject)
                                 throws javax.mail.MessagingException
Creates a MIME message container with the given subject for the given session.

Parameters:
session - the mail sesion
subject - the subject of the message
Returns:
the MIME message with FROM, TO, DATE and SUBJECT headers (without content)
Throws:
javax.mail.MessagingException - if the message cannot be created

createSignedMessage

public javax.mail.Message createSignedMessage(javax.mail.Session session)
                                       throws java.lang.Exception
Creates a signed message containing an ESS SecurityLabel attribute.

Parameters:
session - the mail session
Returns:
the signed message
Throws:
java.lang.Exception - if an error occurs when creating the message

parseMessage

public void parseMessage(javax.mail.Message msg)
                  throws java.io.IOException,
                         javax.mail.MessagingException,
                         java.security.SignatureException
Parses the signed message, verifies the signature and processes the SecurityLabel attribute.

Parameters:
msg - the message to be parsed
Throws:
java.io.IOException - if an I/O related problem occurs
javax.mail.MessagingException - if there is a problem with the message format
java.security.SignatureException - if the signature verification failes

main

public static void main(java.lang.String[] argv)
                 throws java.io.IOException
The main method.

Throws:
java.io.IOException

IAIK CMS/SMIME Toolkit Demo API Documentation
Version 6.1

v6.1
(c) 2002 IAIK, (c) 2003 - 2025 SIC