Fix certificate reading
In some cases there could be garbage at the beginning or end of the certificate file
This commit is contained in:
parent
cb8bb2531e
commit
25c047af28
|
@ -33,7 +33,8 @@ def init(args):
|
||||||
args.certfile = config.get(args.url, 'certfile')
|
args.certfile = config.get(args.url, 'certfile')
|
||||||
if not args.keyfile or not args.certfile:
|
if not args.keyfile or not args.certfile:
|
||||||
raise Exception('key or certificate file not specified')
|
raise Exception('key or certificate file not specified')
|
||||||
args.cert = ''.join(line.strip() for line in open(args.certfile) if not line.startswith('-----'))
|
cert = open(args.certfile).read()
|
||||||
|
args.cert = ''.join(cert[cert.find('-----BEGIN CERTIFICATE-----' + 27):cert.find('-----END CERTIFICATE-----')])
|
||||||
|
|
||||||
case 'pkcs11':
|
case 'pkcs11':
|
||||||
if not args.id:
|
if not args.id:
|
||||||
|
|
Loading…
Reference in a new issue