Overview
Date: 2009-06-07

Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV NEXT | FRAMES NO FRAMES

This library implements the DKIM specification in Java.

See:
Description

Packages
badpenguin.dkim |
badpenguin.dkim.test |

This library implements the DKIM specification in Java. It includes both a Signer and a Verifier. The Verifier can fallback to using DomainKeys if desired, and no DKIM signature is present.

Copyright (c) 2009 Mark Boddington (www.badpenguin.co.uk)
This program is licensed under the terms of the GNU GPL version 2.0.
The DKIM specification is documented in RFC 4871
See: http://www.ietf.org/rfc/rfc4871.txt
The DomainKey Specification is documented in RFC 4870
See: http://www.ietf.org/rfc/rfc4870.txt

## Example Verification

try {
NSKeyStore keyStore = new NSKeyStore("dns", "192.168.1.100");
Verifier ver = new Verifier(keyStore, "DKIM");
InputStream msg = new FileInputStream("/home/mark/googlemail.txt");
if ( ver.verifyMail(msg) )
System.out.println("Message Verified ;-)");
} catch (DkimException d) {
if ( d.getError().equals(DkimError.TEMPFAIL)) {
// message failed, but may succeed later
} else if ( d.getError().equals(DkimError.PERMFAIL)) {
// message failed and will never verify
} else {
// domainkey error
}
} catch (Exception e) {
e.printStackTrace();
}

## Example Signer

try {
msg = new FileInputStream("/home/mark/mymail.txt");
DkimSignature dksig = new DkimSignature("savage", "badpenguin.co.uk");
dksig.setMethod(CanonicalMethod.RELAXED);
dksig.setItag("dkim@badpenguin.co.uk");
dksig.addHeader("received");
Signer signer = new Signer(dksig,key);
String header = signer.signMail(msg);
System.out.println(header);
msg.close();
} catch (DkimException d) {
if ( d.getError().equals(DkimError.TEMPFAIL)) {
// message failed, but may succeed later
} else if ( d.getError().equals(DkimError.PERMFAIL)) {
// message failed and will never verify
} else {
// domainkey error
}
} catch (Exception e) {
e.printStackTrace();
}

Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV NEXT | FRAMES NO FRAMES

© Copyright 2009 Mark Boddington (www.badpenguin.co.uk)