diff --git a/ChangeLog b/ChangeLog index e61bfac..1ad12db 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,6 +1,8 @@ UNRELEASED Version 0.7.0 - Port dkimsign.py to use argparse; now gives standard usage message and is more extensible + - Add command line options to dkimsign.py to select header and body + canonicalization algorithmns (LP: #1272724) 2017-05-30 Version 0.6.2 - Fixed problem with header folding that caused the first line to be diff --git a/dkimsign.py b/dkimsign.py index 021029f..b9567b6 100644 --- a/dkimsign.py +++ b/dkimsign.py @@ -35,6 +35,8 @@ parser = argparse.ArgumentParser(description='Produce DKIM signature for email m parser.add_argument('selector', action="store") parser.add_argument('domain', action="store") parser.add_argument('privatekeyfile', action="store") +parser.add_argument('--hcanon', choices=['simple', 'relaxed'], default='relaxed', type=bytes, help='Header canonicalization algorithm: default=relaxed') +parser.add_argument('--bcanon', choices=['simple', 'relaxed'], default='simple', type=bytes, help='Body canonicalization algorithm: default=simple') parser.add_argument('--identity', help='Optional value for i= tag.') args=parser.parse_args(arguments) @@ -45,7 +47,7 @@ if sys.version_info[0] >= 3: message = sys.stdin.read() try: - sig = dkim.sign(message, args.selector, args.domain, open(args.privatekeyfile, "rb").read(), identity = args.identity) + sig = dkim.sign(message, args.selector, args.domain, open(args.privatekeyfile, "rb").read(), identity = args.identity, canonicalize=(args.hcanon, args.bcanon)) sys.stdout.write(sig) sys.stdout.write(message) except Exception as e: