- Add command line options to dkimsign.py to select header and body

canonicalization algorithmns (LP: #1272724)
This commit is contained in:
Scott Kitterman
2017-06-04 17:21:39 -04:00
parent 818a7f807e
commit b99e029974
2 changed files with 5 additions and 1 deletions
+2
View File
@@ -1,6 +1,8 @@
UNRELEASED Version 0.7.0 UNRELEASED Version 0.7.0
- Port dkimsign.py to use argparse; now gives standard usage message and - Port dkimsign.py to use argparse; now gives standard usage message and
is more extensible 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 2017-05-30 Version 0.6.2
- Fixed problem with header folding that caused the first line to be - Fixed problem with header folding that caused the first line to be
+3 -1
View File
@@ -35,6 +35,8 @@ parser = argparse.ArgumentParser(description='Produce DKIM signature for email m
parser.add_argument('selector', action="store") parser.add_argument('selector', action="store")
parser.add_argument('domain', action="store") parser.add_argument('domain', action="store")
parser.add_argument('privatekeyfile', 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.') parser.add_argument('--identity', help='Optional value for i= tag.')
args=parser.parse_args(arguments) args=parser.parse_args(arguments)
@@ -45,7 +47,7 @@ if sys.version_info[0] >= 3:
message = sys.stdin.read() message = sys.stdin.read()
try: 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(sig)
sys.stdout.write(message) sys.stdout.write(message)
except Exception as e: except Exception as e: