diff options
| author | Timotej Lazar <timotej.lazar@araneo.si> | 2024-01-16 21:51:47 +0100 |
|---|---|---|
| committer | Timotej Lazar <timotej.lazar@araneo.si> | 2024-01-16 21:52:07 +0100 |
| commit | 0578bdffcb0599d2c4f06998281ad968bec43ac0 (patch) | |
| tree | 2d02c2c4763335e5dc973669fde10f0820843e5d | |
| parent | af62cc41a96cc70a844293a10a2ae3fb84c0866e (diff) | |
Use file-based certificates by default
| -rwxr-xr-x | margfools | 8 |
1 files changed, 4 insertions, 4 deletions
@@ -40,9 +40,9 @@ def sign(data, key, pin=None, engine=None): if __name__ == '__main__': parser = argparse.ArgumentParser(description='Fake the MargTools application.') parser.add_argument('url', type=urllib.parse.urlparse, help='bc-digsign:// url') + parser.add_argument('-e', '--engine', type=str, help='"pkcs11" for smart card') parser.add_argument('-k', '--key', type=pathlib.Path, help='key file') parser.add_argument('-c', '--cert', type=pathlib.Path, help='certificate file') - parser.add_argument('-e', '--engine', type=str, help='"pkcs11" for smart card') args = parser.parse_args() try: @@ -51,9 +51,11 @@ if __name__ == '__main__': url = params['baseUrl'][0] token = params['accessToken'][0] - # if missing, get key and cert from section [url] in ~/.margfools + # if missing, get options from section [url] in ~/.margfools config = configparser.ConfigParser() config.read(os.path.expanduser('~') + '/.margfools') + if not args.engine: + args.engine = config.get(url, 'engine', fallback=None) if not args.key: args.key = config.get(url, 'key') if not args.cert: @@ -61,8 +63,6 @@ if __name__ == '__main__': if not args.key: print('key not specified', file=sys.stderr) sys.exit(1) - if not args.engine: - args.engine = config.get(url, 'engine') pin = None |
