Coder Social home page Coder Social logo

usrflo / dkim-for-javamail Goto Github PK

View Code? Open in Web Editor NEW
31.0 3.0 49.0 775 KB

DKIM for JavaMail is a small JAR that can be easily implemented in existing Java projects using JavaMail for sending DKIM signed emails.

License: Apache License 2.0

Java 100.00%
dkim dkim-signature

dkim-for-javamail's Introduction

DKIM-for-JavaMail

DKIM for JavaMail is a small JAR that can be easily implemented in existing Java projects using JavaMail for sending DKIM signed emails.

This github repository replaces the original repository at http://dkim-javamail.sourceforge.net See http://sourceforge.net/p/dkim-javamail/discussion/893011/ for old forum posts.

Setup DKIM for JavaMail API

What is required to use DKIM for JavaMail

  • a project using JavaMail: http://java.sun.com/products/javamail/ (DKIM for JavaMail was tested with version JavaMail 1.4.1 but should be compatible with older versions too, see TODO below)

  • a DKIM key setup:

    There are test keys in the keys/ directory but be aware to use those only for your tests.

    You need:

    a) a private key on your hard disc (e.g. in keys/); you can generate a new key by

    openssl genrsa -out private.key.pem

    DKIM for JavaMail needs the private key in DER format, you can transform a PEM key with openssl:

    openssl pkcs8 -topk8 -nocrypt -in private.key.pem -out private.key.der -outform der

    b) a public key in your DNS; here is a sample ressource record with selector "default": default._domainkey IN TXT "v=DKIM1; g=*; k=rsa; p=MIG...the_public_key_here...AQAB" (see http://www.ietf.org/rfc/rfc4871.txt for details)

    You can use openssl to get a public key from the private key:

    openssl rsa -inform PEM -in private.key.pem -pubout

Run Tests

  • if you want to run the examples provided in DKIM for JavaMail you have to

    a) configure the config file test.properties (see comments inside)

    b) run ant runTests

Implement DKIM for JavaMail into your code

  • add DKIMforJavaMail.jar to your classpath

  • see the example files in test/de/agitos/dkim/* : it's very simple to implement, enjoy!

TODO

  • DKIM for JavaMail is in principal compatible with all libraries using JavaMail, an example for Apache Commons Email should be added to this project

  • test of DKIM for JavaMail with older JavaMail versions, maybe a JAR for Java 1.4; I will do this if needed upon request

  • verification functionality could be added; this has minor priority at time, I will do this if needed upon request (there will be other libraries doing this maybe)

  • the optional public key check before sending should be fully implemented; this is out of the DKIM basic functionality and therefore isn't mandatory

RELEASE-HISTORY

1.0, 2008-11-30

1.1, 2009-04-13 Bugfix line-encoding before body canonicalization on *nix systems Added partial line-folding of the DKIM-Signature header field

1.2, 2009-05-10 Bugfix in signing mime messages that are loaded by an InputStream, Added a MimeMessageTest for testing the signing of loaded mime messages.

1.3, 2009-07-29 Changed the insertion of the DKIM-Signature header to the top most position when sending mail. This is compatible with the Yahoo! DKIM verifier.

Further DKIM Links

http://www.dkim.org/deploy/ : DKIM implementations On this website you can find most MTA-DKIM implementations and complementary products and services.

http://java.sun.com/products/javamail/ : Sun JavaMail API


http://www.agitos.de/dkim-for-java-mail-open-source-library-2.html Florian Sager, [email protected], 22.11.2008

dkim-for-javamail's People

Contributors

usrflo avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

dkim-for-javamail's Issues

Stop requiring To header for DKIM signing

I was surprised when I discovered that this library will only sign emails that have a "From", "To", and "Subject" header. It's perfectly valid to send an email without a "To" header, so long as there are CC or BCC headers instead. It's also valid to create a DKIM signature for any set of headers -- I can't find anywhere in the spec that requires specific ones to be present. In my use case I need to send emails that don't have a To header, and I'd like to keep using this DKIM library. Can you please remove the "To" requirement? I'd be happy to write the patch.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.