Fudge

infrastructure / scripts / dkim.py

Commits | bovarysme Add instructions to upgrade OpenBSD in README.md Committed on Oct 18, 2020

443 B | Download

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
#!/usr/bin/env python3

import sys


def lines(filename):
    with open(filename, 'r') as f:
        for line in f:
            if not line.startswith('-'):
                yield line.rstrip('\n')


def main(filename):
    print('v=DKIM1;k=rsa;p={}'.format(''.join(lines(filename))))


if __name__ == '__main__':
    if len(sys.argv) != 2:
        print('Usage: {} <public key>'.format(sys.argv[0]))
        sys.exit(0)

    main(sys.argv[1])