org.apache.james.mailet.crypto.mailet
Class Sign

java.lang.Object
  extended by org.apache.mailet.base.GenericMailet
      extended by org.apache.james.mailet.crypto.mailet.AbstractSign
          extended by org.apache.james.mailet.crypto.mailet.Sign
All Implemented Interfaces:
Mailet, MailetConfig
Direct Known Subclasses:
SMIMESign

public class Sign
extends AbstractSign

Puts a server-side signature on a message. It is a concrete subclass of AbstractSign, with very few modifications to it.

A text file with an explanation text is attached to the original message, and the resulting message with all its attachments is signed. The resulting appearence of the message is almost unchanged: only an extra attachment and the signature are added.

The kind of signuture depends on the value of the <keyHolderClass> init parameter.

Handles the following init parameters (will comment only the differences from AbstractSign):

Since:
2.2.1
Version:
CVS $Revision$ $Date$

Constructor Summary
Sign()
           
 
Method Summary
protected  String[] getAllowedInitParameters()
          Gets the expected init parameters.
 String getExplanationText()
          Gets text offering an explanation.
 String getMailetInfo()
          Return a string describing this mailet.
protected  javax.mail.internet.MimeBodyPart getWrapperBodyPart(Mail mail)
          A text file with the massaged contents of getExplanationText() is attached to the original message.
protected  void initPostmasterSigns()
          If the <postmasterSigns> init parameter is missing sets it to true.
protected  void initRebuildFrom()
          If the <rebuildFrom> init parameter is missing sets it to true.
 
Methods inherited from class org.apache.james.mailet.crypto.mailet.AbstractSign
fromAddressSameAsReverse, getKeyHolder, getKeyHolderClass, getMessageHeaders, getReplacedExplanationText, getSignerName, init, initDebug, initExplanationText, initKeyHolder, initKeyHolderClass, initSignerName, isDebug, isOkToSign, isPostmasterSigns, isRebuildFrom, service, setDebug, setExplanationText, setKeyHolder, setKeyHolderClass, setPostmasterSigns, setRebuildFrom, setSignerName
 
Methods inherited from class org.apache.mailet.base.GenericMailet
arrayToString, checkInitParameters, destroy, getInitParameter, getInitParameter, getInitParameter, getInitParameterNames, getMailetConfig, getMailetContext, getMailetName, init, log, log
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Sign

public Sign()
Method Detail

getMailetInfo

public String getMailetInfo()
Return a string describing this mailet.

Specified by:
getMailetInfo in interface Mailet
Overrides:
getMailetInfo in class GenericMailet
Returns:
a string describing this mailet

getAllowedInitParameters

protected String[] getAllowedInitParameters()
Description copied from class: AbstractSign
Gets the expected init parameters.

Specified by:
getAllowedInitParameters in class AbstractSign
Returns:
An array containing the parameter names allowed for this mailet.

getExplanationText

public String getExplanationText()
Gets text offering an explanation. If the <explanationText> init parameter is missing returns the following default explanation template string:

 The message this file is attached to has been signed on the server by
     "[signerName]" <[signerAddress]>
 to certify that the sender is known and truly has the following address (reverse-path):
     [reversePath]
 and that the original message has the following message headers:

 [headers]

 The signature envelopes this attachment too.
 Please check the signature integrity.

     "[signerName]" <[signerAddress]>
 

Overrides:
getExplanationText in class AbstractSign
Returns:
Value of property explanationText.

initPostmasterSigns

protected void initPostmasterSigns()
If the <postmasterSigns> init parameter is missing sets it to true.

Overrides:
initPostmasterSigns in class AbstractSign

initRebuildFrom

protected void initRebuildFrom()
                        throws javax.mail.MessagingException
If the <rebuildFrom> init parameter is missing sets it to true.

Overrides:
initRebuildFrom in class AbstractSign
Throws:
javax.mail.MessagingException

getWrapperBodyPart

protected javax.mail.internet.MimeBodyPart getWrapperBodyPart(Mail mail)
                                                       throws javax.mail.MessagingException,
                                                              IOException
A text file with the massaged contents of getExplanationText() is attached to the original message.

Specified by:
getWrapperBodyPart in class AbstractSign
Parameters:
mail - The mail to massage.
Returns:
The massaged MimeBodyPart to sign, or null to have the whole message signed "as is".
Throws:
javax.mail.MessagingException
IOException


Copyright © 2008-2012 The Apache Software Foundation. All Rights Reserved.