org.apache.james.jdkim.mailets
Class DKIMSign

java.lang.Object
  extended by org.apache.mailet.base.GenericMailet
      extended by org.apache.james.jdkim.mailets.DKIMSign
All Implemented Interfaces:
org.apache.mailet.Mailet, org.apache.mailet.MailetConfig

public class DKIMSign
extends org.apache.mailet.base.GenericMailet

This mailet sign a message using the DKIM protocol If the privateKey is encoded using a password then you can pass the password as privateKeyPassword parameter. Sample configuration:


 <mailet match="All" class="DKIMSign">
   <signatureTemplate>v=1; s=selector; d=example.com; h=from:to:received:received; a=rsa-sha256; bh=; b=;</signatureTemplate>
   <privateKey>
   -----BEGIN RSA PRIVATE KEY-----
   MIICXAIBAAKBgQDYDaYKXzwVYwqWbLhmuJ66aTAN8wmDR+rfHE8HfnkSOax0oIoT
   M5zquZrTLo30870YMfYzxwfB6j/Nz3QdwrUD/t0YMYJiUKyWJnCKfZXHJBJ+yfRH
   r7oW+UW3cVo9CG2bBfIxsInwYe175g9UjyntJpWueqdEIo1c2bhv9Mp66QIDAQAB
   AoGBAI8XcwnZi0Sq5N89wF+gFNhnREFo3rsJDaCY8iqHdA5DDlnr3abb/yhipw0I
   /1HlgC6fIG2oexXOXFWl+USgqRt1kTt9jXhVFExg8mNko2UelAwFtsl8CRjVcYQO
   cedeH/WM/mXjg2wUqqZenBmlKlD6vNb70jFJeVaDJ/7n7j8BAkEA9NkH2D4Zgj/I
   OAVYccZYH74+VgO0e7VkUjQk9wtJ2j6cGqJ6Pfj0roVIMUWzoBb8YfErR8l6JnVQ
   bfy83gJeiQJBAOHk3ow7JjAn8XuOyZx24KcTaYWKUkAQfRWYDFFOYQF4KV9xLSEt
   ycY0kjsdxGKDudWcsATllFzXDCQF6DTNIWECQEA52ePwTjKrVnLTfCLEG4OgHKvl
   Zud4amthwDyJWoMEH2ChNB2je1N4JLrABOE+hk+OuoKnKAKEjWd8f3Jg/rkCQHj8
   mQmogHqYWikgP/FSZl518jV48Tao3iXbqvU9Mo2T6yzYNCCqIoDLFWseNVnCTZ0Q
   b+IfiEf1UeZVV5o4J+ECQDatNnS3V9qYUKjj/krNRD/U0+7eh8S2ylLqD3RlSn9K
   tYGRMgAtUXtiOEizBH6bd/orzI9V9sw8yBz+ZqIH25Q=
   -----END RSA PRIVATE KEY-----
   </privateKey>
 </mailet>
 
By default the mailet assume that Javamail will convert LF to CRLF when sending so will compute the hash using converted newlines. If you don't want this behaviout then set forceCRLF attribute to false.


Constructor Summary
DKIMSign()
           
 
Method Summary
protected  PrivateKey getPrivateKey()
           
protected  String getSignatureTemplate()
           
 void init()
           
 void service(org.apache.mailet.Mail mail)
           
 
Methods inherited from class org.apache.mailet.base.GenericMailet
arrayToString, checkInitParameters, destroy, getInitParameter, getInitParameter, getInitParameter, getInitParameterNames, getMailetConfig, getMailetContext, getMailetInfo, getMailetName, init, log, log
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

DKIMSign

public DKIMSign()
Method Detail

getSignatureTemplate

protected String getSignatureTemplate()
Returns:
the signatureTemplate

getPrivateKey

protected PrivateKey getPrivateKey()
Returns:
the privateKey

init

public void init()
          throws javax.mail.MessagingException
Overrides:
init in class org.apache.mailet.base.GenericMailet
Throws:
javax.mail.MessagingException

service

public void service(org.apache.mailet.Mail mail)
             throws javax.mail.MessagingException
Specified by:
service in interface org.apache.mailet.Mailet
Specified by:
service in class org.apache.mailet.base.GenericMailet
Throws:
javax.mail.MessagingException


Copyright © 2009-2011 The Apache Software Foundation. All Rights Reserved.