Java DKIM Mailets

At the moment the mailet package includes 2 mailets: ConvertTo7Bit and DKIMSign

ConvertTo7Bit is simply required because when DKIM signing we have to make sure that the MTAs involved in the delivery of our message won't alter the byte stream of our signed message and 7bit messages are more likely to be transported without further conversions. So, make sure to use ConvertTo7Bit just before DKIMSign mailet.

DKIMSign is the signing mailet. Make sure you use this one as the last mailet before delivery otherwise further JavaMail interactions with a signed message would lead in a broken signature.

Here is a sample configuration for DKIMSign

<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>
 		

If your PEM file is password encrypted then you can add a privateKeyPassword argument to the mailet