Java Doc for SMIMEAbstractSign.java in  » Net » james-2.3.1 » org » apache » james » transport » mailets » smime » Java Source Code / Java DocumentationJava Source Code and Java Documentation

Java Source Code / Java Documentation
1. 6.0 JDK Core
2. 6.0 JDK Modules
3. 6.0 JDK Modules com.sun
4. 6.0 JDK Modules com.sun.java
5. 6.0 JDK Modules sun
6. 6.0 JDK Platform
7. Ajax
8. Apache Harmony Java SE
9. Aspect oriented
10. Authentication Authorization
11. Blogger System
12. Build
13. Byte Code
14. Cache
15. Chart
16. Chat
17. Code Analyzer
18. Collaboration
19. Content Management System
20. Database Client
21. Database DBMS
22. Database JDBC Connection Pool
23. Database ORM
24. Development
25. EJB Server geronimo
26. EJB Server GlassFish
27. EJB Server JBoss 4.2.1
28. EJB Server resin 3.1.5
29. ERP CRM Financial
30. ESB
31. Forum
32. GIS
33. Graphic Library
34. Groupware
35. HTML Parser
36. IDE
37. IDE Eclipse
38. IDE Netbeans
39. Installer
40. Internationalization Localization
41. Inversion of Control
42. Issue Tracking
43. J2EE
44. JBoss
45. JMS
46. JMX
47. Library
48. Mail Clients
49. Net
50. Parser
51. PDF
52. Portal
53. Profiler
54. Project Management
55. Report
56. RSS RDF
57. Rule Engine
58. Science
59. Scripting
60. Search Engine
61. Security
62. Sevlet Container
63. Source Control
64. Swing Library
65. Template Engine
66. Test Coverage
67. Testing
68. UML
69. Web Crawler
70. Web Framework
71. Web Mail
72. Web Server
73. Web Services
74. Web Services apache cxf 2.0.1
75. Web Services AXIS2
76. Wiki Engine
77. Workflow Engines
78. XML
79. XML UI
Java
Java Tutorial
Java Open Source
Jar File Download
Java Articles
Java Products
Java by API
Photoshop Tutorials
Maya Tutorials
Flash Tutorials
3ds-Max Tutorials
Illustrator Tutorials
GIMP Tutorials
C# / C Sharp
C# / CSharp Tutorial
C# / CSharp Open Source
ASP.Net
ASP.NET Tutorial
JavaScript DHTML
JavaScript Tutorial
JavaScript Reference
HTML / CSS
HTML CSS Reference
C / ANSI-C
C Tutorial
C++
C++ Tutorial
Ruby
PHP
Python
Python Tutorial
Python Open Source
SQL Server / T-SQL
SQL Server / T-SQL Tutorial
Oracle PL / SQL
Oracle PL/SQL Tutorial
PostgreSQL
SQL / MySQL
MySQL Tutorial
VB.Net
VB.Net Tutorial
Flash / Flex / ActionScript
VBA / Excel / Access / Word
XML
XML Tutorial
Microsoft Office PowerPoint 2007 Tutorial
Microsoft Office Excel 2007 Tutorial
Microsoft Office Word 2007 Tutorial
Java Source Code / Java Documentation » Net » james 2.3.1 » org.apache.james.transport.mailets.smime 
Source Cross Reference  Class Diagram Java Document (Java Doc) 


java.lang.Object
   org.apache.mailet.GenericMailet
      org.apache.james.transport.mailets.smime.SMIMEAbstractSign

All known Subclasses:   org.apache.james.transport.mailets.smime.SMIMESign,
SMIMEAbstractSign
abstract public class SMIMEAbstractSign extends GenericMailet (Code)

Abstract mailet providing common SMIME signature services.
It can be subclassed to make authoring signing mailets simple.
By extending it and overriding one or more of the following methods a new behaviour can be quickly created without the author having to address any issue other than the relevant one:

Handles the following init parameters:

  • <debug>: if true some useful information is logged. The default is false.
  • <keyStoreFileName>: the java.security.KeyStore full file name.
  • <keyStorePassword>: the KeyStore password. If given, it is used to check the integrity of the keystore data, otherwise, if null, the integrity of the keystore is not checked.
  • <keyAlias>: the alias name to use to search the Key using java.security.KeyStore.getKey . The default is to look for the first and only alias in the keystore; if zero or more than one is found a java.security.KeyStoreException is thrown.
  • <keyAliasPassword>: the alias password. The default is to use the KeyStore password. At least one of the passwords must be provided.
  • <keyStoreType>: the type of the keystore. The default will use java.security.KeyStore.getDefaultType .
  • <postmasterSigns>: if true the message will be signed even if the sender is the Postmaster. The default is false.
  • <rebuildFrom>: If true will modify the "From:" header. For more info see SMIMEAbstractSign.isRebuildFrom . The default is false.
  • <signerName>: the name of the signer to be shown in the explanation text. The default is to use the "CN=" property of the signing certificate.
  • <explanationText>: the text of an explanation of the meaning of this server-side signature. May contain the following substitution patterns (see also SMIMEAbstractSign.getReplacedExplanationText ): [signerName], [signerAddress], [reversePath], [headers]. It should be included in the signature. The actual presentation of the text depends on the specific concrete mailet subclass: see for example SMIMESign . The default is to not have any explanation text.

version:
   CVS $Revision: 494012 $ $Date: 2007-01-08 11:23:58 +0100 (Mo, 08 Jan 2007) $
since:
   2.2.1




Method Summary
final protected  booleanfromAddressSameAsReverse(Mail mail)
     Utility method that checks if there is at least one address in the "From:" header same as the reverse-path.
Parameters:
  mail - The mail to check.
abstract protected  String[]getAllowedInitParameters()
     Gets the expected init parameters.
public  StringgetExplanationText()
     Getter for property explanationText.
protected  KeyHoldergetKeyHolder()
     Getter for property keyHolder.
final protected  StringgetMessageHeaders(MimeMessage message)
     Utility method for obtaining a string representation of the Message's headers
Parameters:
  message - The message to extract the headers from.
final protected  StringgetReplacedExplanationText(String explanationText, String signerName, String signerAddress, String reversePath, String headers)
     Prepares the explanation text making substitutions in the explanationText template string. Utility method that searches for all occurrences of some pattern strings and substitute them with the appropriate params.
Parameters:
  explanationText - The template string for the explanation text.
Parameters:
  signerName - The string that will replace the [signerName] pattern.
Parameters:
  signerAddress - The string that will replace the [signerAddress] pattern.
Parameters:
  reversePath - The string that will replace the [reversePath] pattern.
Parameters:
  headers - The string that will replace the [headers] pattern.
public  StringgetSignerName()
     Getter for property signerName.
abstract protected  MimeBodyPartgetWrapperBodyPart(Mail mail)
     Creates the javax.mail.internet.MimeBodyPart that will be signed. For example, may attach a text file explaining the meaning of the signature, or an XML file containing information that can be checked by other MTAs.
Parameters:
  mail - The mail to massage.
public  voidinit()
     Mailet initialization routine.
protected  voidinitDebug()
     Initializer for property debug.
protected  voidinitExplanationText()
     Initializer for property explanationText.
protected  voidinitKeyHolder()
     Initializer for property keyHolder.
protected  voidinitPostmasterSigns()
     Initializer for property postmasterSigns.
protected  voidinitRebuildFrom()
     Initializer for property rebuildFrom.
protected  voidinitSignerName()
     Initializer for property signerName.
public  booleanisDebug()
     Getter for property debug.
protected  booleanisOkToSign(Mail mail)
    

Checks if the mail can be signed.

Rules:

  1. The reverse-path != null (it is not a bounce).
  2. The sender user must have been SMTP authenticated.
  3. Either:
    • The reverse-path is the postmaster address and SMIMEAbstractSign.isPostmasterSigns returns true
    • or the reverse-path == the authenticated user and there is at least one "From:" address == reverse-path.
    • .
  4. The message has not already been signed (mimeType != multipart/signed and != application/pkcs7-mime).

Parameters:
  mail - The mail object to check.
public  booleanisPostmasterSigns()
     Getter for property postmasterSigns.
public  booleanisRebuildFrom()
     Getter for property rebuildFrom. If true will modify the "From:" header.

The modification is as follows: assuming that the signer mail address in the signer certificate is trusted-server@xxx.com> and that From: "John Smith" we will get From: "John Smith" " <trusted-server@xxx.com>.

If the "ReplyTo:" header is missing or empty it will be set to the original "From:" header.

Such modification is necessary to achieve a correct behaviour with some mail clients (e.g.

public  voidservice(Mail mail)
    
public  voidsetDebug(boolean debug)
     Setter for property debug.
public  voidsetExplanationText(String explanationText)
     Setter for property explanationText.
protected  voidsetKeyHolder(KeyHolder keyHolder)
     Setter for property keyHolder.
public  voidsetPostmasterSigns(boolean postmasterSigns)
     Setter for property postmasterSigns.
public  voidsetRebuildFrom(boolean rebuildFrom)
     Setter for property rebuildFrom.
public  voidsetSignerName(String signerName)
     Setter for property signerName.



Method Detail
fromAddressSameAsReverse
final protected boolean fromAddressSameAsReverse(Mail mail)(Code)
Utility method that checks if there is at least one address in the "From:" header same as the reverse-path.
Parameters:
  mail - The mail to check. True if an address is found, false otherwise.



getAllowedInitParameters
abstract protected String[] getAllowedInitParameters()(Code)
Gets the expected init parameters. An array containing the parameter names allowed for this mailet.



getExplanationText
public String getExplanationText()(Code)
Getter for property explanationText. Text to be used in the SignatureExplanation.txt file. Value of property explanationText.



getKeyHolder
protected KeyHolder getKeyHolder()(Code)
Getter for property keyHolder. It is protected instead of public for security reasons. Value of property keyHolder.



getMessageHeaders
final protected String getMessageHeaders(MimeMessage message) throws MessagingException(Code)
Utility method for obtaining a string representation of the Message's headers
Parameters:
  message - The message to extract the headers from. The string containing the headers.



getReplacedExplanationText
final protected String getReplacedExplanationText(String explanationText, String signerName, String signerAddress, String reversePath, String headers)(Code)
Prepares the explanation text making substitutions in the explanationText template string. Utility method that searches for all occurrences of some pattern strings and substitute them with the appropriate params.
Parameters:
  explanationText - The template string for the explanation text.
Parameters:
  signerName - The string that will replace the [signerName] pattern.
Parameters:
  signerAddress - The string that will replace the [signerAddress] pattern.
Parameters:
  reversePath - The string that will replace the [reversePath] pattern.
Parameters:
  headers - The string that will replace the [headers] pattern. The actual explanation text string with all replacements done.



getSignerName
public String getSignerName()(Code)
Getter for property signerName. Value of property signerName.



getWrapperBodyPart
abstract protected MimeBodyPart getWrapperBodyPart(Mail mail) throws MessagingException, IOException(Code)
Creates the javax.mail.internet.MimeBodyPart that will be signed. For example, may attach a text file explaining the meaning of the signature, or an XML file containing information that can be checked by other MTAs.
Parameters:
  mail - The mail to massage. The massaged MimeBodyPart to sign, or null to have the whole message signed "as is".



init
public void init() throws MessagingException(Code)
Mailet initialization routine.



initDebug
protected void initDebug()(Code)
Initializer for property debug.



initExplanationText
protected void initExplanationText()(Code)
Initializer for property explanationText.



initKeyHolder
protected void initKeyHolder() throws Exception(Code)
Initializer for property keyHolder.



initPostmasterSigns
protected void initPostmasterSigns()(Code)
Initializer for property postmasterSigns.



initRebuildFrom
protected void initRebuildFrom() throws MessagingException(Code)
Initializer for property rebuildFrom.



initSignerName
protected void initSignerName()(Code)
Initializer for property signerName.



isDebug
public boolean isDebug()(Code)
Getter for property debug. Value of property debug.



isOkToSign
protected boolean isOkToSign(Mail mail) throws MessagingException(Code)

Checks if the mail can be signed.

Rules:

  1. The reverse-path != null (it is not a bounce).
  2. The sender user must have been SMTP authenticated.
  3. Either:
    • The reverse-path is the postmaster address and SMIMEAbstractSign.isPostmasterSigns returns true
    • or the reverse-path == the authenticated user and there is at least one "From:" address == reverse-path.
    • .
  4. The message has not already been signed (mimeType != multipart/signed and != application/pkcs7-mime).

Parameters:
  mail - The mail object to check. True if can be signed.



isPostmasterSigns
public boolean isPostmasterSigns()(Code)
Getter for property postmasterSigns. If true will sign messages signed by the postmaster. Value of property postmasterSigns.



isRebuildFrom
public boolean isRebuildFrom()(Code)
Getter for property rebuildFrom. If true will modify the "From:" header.

The modification is as follows: assuming that the signer mail address in the signer certificate is trusted-server@xxx.com> and that From: "John Smith" we will get From: "John Smith" " <trusted-server@xxx.com>.

If the "ReplyTo:" header is missing or empty it will be set to the original "From:" header.

Such modification is necessary to achieve a correct behaviour with some mail clients (e.g. Microsoft Outlook Express).

Value of property rebuildFrom.



service
public void service(Mail mail) throws MessagingException(Code)
Service does the hard work, and signs
Parameters:
  mail - the mail to sign
throws:
  MessagingException - if a problem arises signing the mail



setDebug
public void setDebug(boolean debug)(Code)
Setter for property debug.
Parameters:
  debug - New value of property debug.



setExplanationText
public void setExplanationText(String explanationText)(Code)
Setter for property explanationText.
Parameters:
  explanationText - New value of property explanationText.



setKeyHolder
protected void setKeyHolder(KeyHolder keyHolder)(Code)
Setter for property keyHolder. It is protected instead of public for security reasons.
Parameters:
  keyHolder - New value of property keyHolder.



setPostmasterSigns
public void setPostmasterSigns(boolean postmasterSigns)(Code)
Setter for property postmasterSigns.
Parameters:
  postmasterSigns - New value of property postmasterSigns.



setRebuildFrom
public void setRebuildFrom(boolean rebuildFrom)(Code)
Setter for property rebuildFrom.
Parameters:
  rebuildFrom - New value of property rebuildFrom.



setSignerName
public void setSignerName(String signerName)(Code)
Setter for property signerName.
Parameters:
  signerName - New value of property signerName.



Methods inherited from org.apache.mailet.GenericMailet
public void destroy()(Code)(Java Doc)
public String getInitParameter(String name)(Code)(Java Doc)
public String getInitParameter(String name, String defValue)(Code)(Java Doc)
public Iterator getInitParameterNames()(Code)(Java Doc)
public MailetConfig getMailetConfig()(Code)(Java Doc)
public MailetContext getMailetContext()(Code)(Java Doc)
public String getMailetInfo()(Code)(Java Doc)
public String getMailetName()(Code)(Java Doc)
public void init(MailetConfig newConfig) throws MessagingException(Code)(Java Doc)
public void init() throws MessagingException(Code)(Java Doc)
public void log(String message)(Code)(Java Doc)
public void log(String message, Throwable t)(Code)(Java Doc)
abstract public void service(Mail mail) throws javax.mail.MessagingException(Code)(Java Doc)

Methods inherited from java.lang.Object
native protected Object clone() throws CloneNotSupportedException(Code)(Java Doc)
public boolean equals(Object obj)(Code)(Java Doc)
protected void finalize() throws Throwable(Code)(Java Doc)
final native public Class getClass()(Code)(Java Doc)
native public int hashCode()(Code)(Java Doc)
final native public void notify()(Code)(Java Doc)
final native public void notifyAll()(Code)(Java Doc)
public String toString()(Code)(Java Doc)
final native public void wait(long timeout) throws InterruptedException(Code)(Java Doc)
final public void wait(long timeout, int nanos) throws InterruptedException(Code)(Java Doc)
final public void wait() throws InterruptedException(Code)(Java Doc)

www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.